8000 GitHub - daggerok/spring-security-testing: testing secured spring application, gradle, spring-boot, spring oauth2, basic authentication, oauth2 authentication, spring JWT token converter, RSA, spring-mvc, gradle, gradle multi project, gradle include builds, gradle custom docker-compose usage, jks, keytool, openssl, SSL, @EnableAuthorizationServer configuration, @EnableResourceServer configuration
[go: up one dir, main page]

Skip to content

testing secured spring application, gradle, spring-boot, spring oauth2, basic authentication, oauth2 authentication, spring JWT token converter, RSA, spring-mvc, gradle, gradle multi project, gradle include builds, gradle custom docker-compose usage, jks, keytool, openssl, SSL, @EnableAuthorizationServer configuration, @EnableResourceServer conf…

Notifications You must be signed in to change notification settings

daggerok/spring-security-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

testing spring security application Build Status

implemented auth and resource servers with JWT

keytool usage for generating jks (java key store) files

mkdir -p oauth2/auth-server/src/main/resources/security
cd oauth2/auth-server/src/main/resources/security

# generate jks key (for auth-server)
keytool -genkeypair -alias oauth2 \
  -keyalg RSA \
  -keypass oauth2pass \
  -keystore oauth2.jks \
  -storepass oauth2pass
# console io:
What is your first and last name?
  [Unknown]:  Maksim Kostromin
What is the name of your organizational unit?
  [Unknown]:  daggerok
What is the name of your organization?
  [Unknown]:  daggerok
What is the name of your City or Locality?
  [Unknown]:  Odessa
What is the name of your State or Province?
  [Unknown]:  Odessa
What is the two-letter country code for this unit?
  [Unknown]:  UA
Is CN=Maksim Kostromin, OU=daggerok, O=daggerok, L=Odessa, ST=Odessa, C=UA correct?
  [no]:  yes

# export public key (for reource-server)
keytool -list -rfc --keystore oauth2.jks | openssl x509 -inform pem -pubkey
# console io:
Enter keystore password:  oauth2pass
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmIltKGgvSryK6s0Z8IEi
vYLGYbcvu6D6cAJLEpOCH2Qrm9qxCx7gZXi548PiHdajUaMuyBmK8hQLPqYeNOS3
X1ekZjn4i9wzsWLlisIzr9sJQPtA6URh48mx0HPOBVPk7Tu1w7ebZBL/H9m8Be8T
BS7tw1cygMi9BnvBPwVR5TZFFIKFBJdP3TZ6zvlJbYUDA3TQSzaybRhq+HL4wjv4
paUxkd4JelfQDBmfQyk2gLnhNk0wujvJKX7LdfeSRtV26KGY7Hrmrc8CPZsukwGX
t6JkwWpn3oWH/+9LJS/G4jdzf7Zod8tpacALCm6Kllw5UxXmqJJYFfH8xd61S9QR
lwIDAQAB
-----END PUBLIC KEY-----
...

# export private key (for auth-server)
keytool -importkeystore -srckeystore oauth2.jks -destkeystore oauth2.p12 -deststoretype PKCS12
openssl pkcs12 -in oauth2.p12 -nodes -nocerts
Enter Import Password:
MAC verified OK
Bag Attributes
    friendlyName: oauth2
    localKeyID: 54 69 6D 65 20 31 34 39 35 37 38 34 35 33 32 38 39 33
Key Attributes: <No Attributes>
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAmIltKGgvSryK6s0Z8IEivYLGYbcvu6D6cAJLEpOCH2Qrm9qx
Cx7gZXi548PiHdajUaMuyBmK8hQLPqYeNOS3X1ekZjn4i9wzsWLlisIzr9sJQPtA
6URh48mx0HPOBVPk7Tu1w7ebZBL/H9m8Be8TBS7tw1cygMi9BnvBPwVR5TZFFIKF
BJdP3TZ6zvlJbYUDA3TQSzaybRhq+HL4wjv4paUxkd4JelfQDBmfQyk2gLnhNk0w
ujvJKX7LdfeSRtV26KGY7Hrmrc8CPZsukwGXt6JkwWpn3oWH/+9LJS/G4jdzf7Zo
d8tpacALCm6Kllw5UxXmqJJYFfH8xd61S9QRlwIDAQABAoIBAHMuOoXrfeJyUneQ
nki0SlZNvJ0mpV2J5fHUWXnSdsxbaG6MiWl7TDhzG/L4A/NCExrfHMEuQHQhXIhX
CbIpDqpo1JP4rEx333TP18KaeEsPG4K89rvtzfkiYSmleGkfe1sD3nHGYAkGKy2S
zV6xs2wTjqgVXOZQLiQKKNb8nmV0FJi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PRIVATE KEY-----
gradle clean install

dev

gradle -t test
gradle integrationTests

docker-compose

gradle composeUp
gradle composeDown

About

testing secured spring application, gradle, spring-boot, spring oauth2, basic authentication, oauth2 authentication, spring JWT token converter, RSA, spring-mvc, gradle, gradle multi project, gradle include builds, gradle custom docker-compose usage, jks, keytool, openssl, SSL, @EnableAuthorizationServer configuration, @EnableResourceServer conf…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0