http POST http://localhost:8080/users username=admin password=changeme authority=write
http POST http://localhost:8080/clients clientId=client clientSecret=secret scope=write
To get an access token:
curl -v -XPOST -u client:secret "http://localhost:8080/oauth/token?grant_type=password&username=john&password=12345&scope=read"
http -a client:secret POST localhost:8080/oauth/token grant_type==password username==john password==12345 scope==read
Open in the browser and login:
http://localhost:8080/oauth/authorize?response_type=code&client_id=client&scope=read
You'll be redirected to a non-existing service but you can fetch the code from the URL. Use the code here to get an access token:
curl -v -XPOST -u client:secret "http://localhost:8080/oauth/token?grant_type=authorization_code&scope=read&code={CODE}"
To get an access token:
curl -v -XPOST -u client:secret "http://localhost:8080/oauth/token?grant_type=client_credentials&scope=info"
http -a adviceClient:adviceSecret POST "http://localhost:8080/oauth/token?grant_type=client_credentials&scope=advice"
To get an access token and a refresh token:
curl -v -XPOST -u client:secret "http://localhost:8080/oauth/token?grant_type=password&username=john&password=12345&scope=read"
To get an access token and a refresh token:
curl -v -XPOST -u client:secret "http://localhost:8080/oauth/token?grant_type=password&username=john&password=12345&scope=read"
To get the public key:
curl -u client:secret "http://localhost:8080/oauth/token_key"
Generation:
keytool -genkeypair -alias ssia -keyalg RSA -keysize 2048 -keypass ssia123 -keystore ssia.jks -storepass ssia123
Get public key:
keytool -list -rfc --keystore ssia.jks | openssl x509 -inform pem -pubkey
Access resource with token:
curl -H "Authorization:Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." "http://localhost:8081/profile/john"
curl -H "Authorization:Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." "http://localhost:8081/metric/john"
Run:
/realpath/to/mvn -N io.takari:maven:wrapper
/realpath/to/mwn
because on my system I have:
alias mvn=mvn-or-mvnw