Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: OAuth 2 without Spring MVC?

  1. #11
    Join Date
    May 2005
    Location
    Denver, CO, USA
    Posts
    57

    Default

    Interestingly, if I add on a trailing '/':

    Code:
    [imac:~] jas% curl -w "\nhttp code: %{http_code}\n" --include -d "grant_type=client_credentials&client_id=myClientId&client_secret=myClientSecret" "http://localhost:9090/isec/oauth/token/"
    HTTP/1.1 302 Found
    WWW-Authenticate: Bearer
    Location: http://localhost:9090/isec/spring_security_login
    Content-Length: 0
    Server: Jetty(7.2.2.v20101205)
    
    http code: 302
    [imac:~]
    So, I'm being challenged to provide a bearer token. But, that's what I'm trying to acquire using my client credentials. I'm guessing this is due to:

    Code:
    <intercept-url pattern="/oauth/**" access="ROLE_CLIENT,ROLE_PARTNER" />
    Roles where specified in the example config, and setting that to IS_AUTHENTICATED_ANONYMOUSLY gets me back to "not found". Makes sense I guess.

    Cheers,

    Jeff

  2. #12
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    As far as I can tell your web.xml doesn't map any valid URLs onto the "spring" servlet. It will only serve up tokens for you if it is allowed to handle /oauth/token (by default) - and I think that's probably relative to the servlet path as well, so maybe if you map /oauth/** to the spring servlet you might make some progress.

    The WWW-Authenticate header is clearly wrong (please raise a JIRA if you have a chance), but that's not the main problem here.
    Last edited by Dave Syer; Jan 30th, 2012 at 10:31 AM. Reason: spelling

  3. #13
    Join Date
    May 2005
    Location
    Denver, CO, USA
    Posts
    57

    Default Doh!

    Thanks Dave!

    For whatever reason I figured the DispatcherServlet's context def was what was important and not the servlet itself. So, I had it mapped to /notused. Changing it to / (per the examples), I got something more to my liking.

    Looks like I need to go over my changes made to my services when moving from M4 to M5.

    Code:
    2012-01-30 10:09:37 DEBUG cassandra.CassandraClientDetailsService - loadClientByClientId - loading details for clientId: myClientId
    2012-01-30 10:09:37 DEBUG cassandra.CassandraClientDetailsService - loadClientByClientId - for clientId: myClientId, returning details: IsecClientDetails [ clientId: myClientId, tenantId: myTentantId, resourceIds: null, grantTypes: [client_credentials], scope: null, authorities: [ROLE_CLIENT], solrSearchHandler: partner-tmo, solrProductCore: partner-tmo]
    2012-01-30 10:09:37.963:WARN::/isec/oauth/token
    java.lang.NullPointerException
    	at java.util.HashSet.<init>(HashSet.java:99)
    	at org.springframework.security.oauth2.provider.client.ClientCredentialsTokenGranter.grant(ClientCredentialsTokenGranter.java:97)
    	at org.springframework.security.oauth2.provider.CompositeTokenGranter.grant(CompositeTokenGranter.java:41)
    	at org.springframework.security.oauth2.provider.endpoint.TokenEndpoint.getAccessToken(TokenEndpoint.java:60)
    At least I can look at my own code for now.

    Once I get this thing running again, I'll look into submitting the JIRA you suggested.

    Cheers,

    Jeff

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •