IBM Verify

IBM Verify

Join this online user group to communicate across Security product users and IBM experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Comparing Auth0 and ISAM with spring and having issues with ISAM

    Posted Wed June 05, 2019 11:09 AM

    Here are the steps that I used in Auth0:

     Create API – I gave it a name but the key is the Identifier which is used as the audience name when requesting the token. 

    1. Had to create a custom scope for the Cloud API
    2. Create the Application
    3. Request a token via postman for ease here is a CURL command

    curl --request POST \

      --url https://xxxxx/oauth/token \

      --header 'content-type: application/json' \

      --data '{"client_id":"xxxx","client_secret":"xxxGmOBDDo","audience":"https://xxxx.com/cloud","grant_type":"client_credentials"}'

     

    1. The response would be:
    "access_token": "xxxxxx""token_type": "Bearer"}

     

    1. The token is submitted as part of the header token like the below example:
    curl --request GET \  --url http://path_to_your_api/ \  --header 'authorization: Bearer eyJ0eXAiOixxxx'

     

    1. Spring is validating the token via the by having the following two details:

    security.oauth2.resource.jwk.keySetUri=https://xxxx/.well-known/jwks.json

    security.oauth2.resource.id=https://xxxx/cloud

    I think the security.oauth2.resource.id might be one of the keys to our issues, as this value is established by the API in step 1, this would equate to you having set up the API defination, but I'm not sure what the value is set here or there is a custom value i can set.  We tried using: http://appliesto/oauthjwt when we tried to get this to work with ISAM. 

     

    The error that we get with ISAM is:

    {

        "error": "invalid_token",

        "error_description": "Invalid JWT/JWS: kid is a required JOSE Header"

    }

     

    The configuration values that we had in place for ISAM are as follows:

    security.oauth2.resource.jwk.keySetUri=https://xxxxx/mga/sps/oauth/oauth20/jwks/APIname

    security.oauth2.resource.id=http://appliesto/oauthjwt

     

    Looking at the note

    https://stackoverflow.com/questions/55659509/invalid-jwtoken-kid-is-a-required-jose-header

     

    I noticed their keys had dashes and the ones that I'm using do not…so I change it to be:

    security.oauth2.resource.jwk.keyUri=https://xxxx/mga/sps/oauth/oauth20/jwks/APIname

    security.oauth2.resource.id=http://appliesto/oauthjwt

     

    I got a different error message from Java once I hit the server:

    java.lang.IllegalArgumentException: URI is not absolute

           at java.net.URI.toURL(URI.java:1088) ~[na:1.8.0_91]

           at org.springframework.http.client.SimpleClientHttpRequestFactory.createRequest(SimpleClientHttpRequestFactory.java:145) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]

     

    I tried to pull up the URL https://xxxx/mga/sps/oauth/oauth20/jwks/APIname and notice it requires login, which means spring would not be able to use it to get the certs details. 

     

    So in summary:

    • I need the correct resource.id entry as I don't think http://appliesto/oauthjwt this seems correct
    • Need to be able to get to the public key without authorization

    Any direction or help would be appreciated

    ------------------------------
    Mubashir Naseer
    Volkswagen of America
    Detroit MI
    ------------------------------


  • 2.  RE: Comparing Auth0 and ISAM with spring and having issues with ISAM

    Posted Wed June 05, 2019 11:34 AM
    Hello Mubashir,

    Your JWKS endpoint should be unauthenticated :


    Please make sure you use the 'OAuth and OpenID Connect Provider Configuration' if you're at the 9.0.6.0 firmware level to set the ACLs correctly for your object space.

    ------------------------------
    JACK YARBOROUGH
    ------------------------------



  • 3.  RE: Comparing Auth0 and ISAM with spring and having issues with ISAM

    Posted Wed June 05, 2019 11:42 AM
    Mubashir,

    I assume that you have configured ISAM to generate a JWT and use this as the Access Token.

    From your description, it sounds like the security.oauth2.resource.id needs to match the audience in the JWT.  If you decode the JWT that Access Manger is creating, can you see an "aud" field?  If so, maybe try setting the resource.id to match that?

    If some other audience is required in the JWT, you should be able to set that in the JWT module configuration or in the mapping rule of the STS chain?

    Jon.

    ------------------------------
    Jon Harry
    Consulting IT Security Specialist
    IBM
    ------------------------------