Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring security OAuth - check validity of access token?

I am following this sample code from Spring Security OAuth.

After I got the access token when I try to check the token

curl -X POST http://localhost:9999/uaa/oauth/check_token -d "token=e3f44c4f-f8f2-45c4-9f9e-c7dd1f583a1f"

I get the following error:

{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}

I tried passing client id and secret.

curl -X POST acme:acmesecret@localhost:9999/uaa/oauth/check_token -d "token=e3f44c4f-f8f2-45c4-9f9e-c7dd1f583a1f"

I get 403 status.

{"timestamp":1437683976536,"status":403,"error":"Forbidden","message":"Access is denied","path":"/uaa/oauth/check_token”}

I am unable to figure out what is going wrong. Any help here is much appreciated.

like image 226
brain storm Avatar asked Jul 23 '15 23:07

brain storm


1 Answers

Try to play with /check_token authorization rights via:

public class OAuthSecurityConfig extends AuthorizationServerConfigurerAdapter {
   @Override 
   public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception { 
       oauthServer.checkTokenAccess("permitAll()"); 
   }
}
like image 163
nKognito Avatar answered Nov 09 '22 06:11

nKognito