Configuring OIDC to use client_credentials - InvalidMessageContext

Henri Mikkonen henri.mikkonen at nimbleidm.com
Mon Sep 9 06:48:33 UTC 2024


Hi Gary,

As the logs indicate, the error is that the resource metadata doesn't 
contain valid combination of encryption parameters and credentials.

As documented in the OAuth Profile-specific settings for 
OAUTH2.TokenAudience [1], the default value for encryptionOptional is 
'false'. You need to change that to disable encryption. If you wish to 
encrypt the JWT access token, then you need to modify the resource 
metadata to contain valid combination of encryption parameters and 
credentials.

BR,
Henri.

[1] 
https://shibboleth.atlassian.net/wiki/spaces/IDPPLUGINS/pages/2931425281/OPTokenAudience

On 9.9.2024 8.56, Lipscomb, Gary wrote:
> Hi Henri,
> 
> thanks for pick on saml:Audience.  All working there.
> 
> The issue I now have is errors with encrypting the JWT token
> 
> 024-09-09 15:40:18,360 - 10.0.2.2 - WARN 
> [net.shibboleth.oidc.security.jose.impl.ClientInformationKeyTransportEncryptionAlgorithmsLookupStrategy:117] - No supported key transport algorithm. Client metadata and configuration are not compatible
> 2024-09-09 15:40:18,372 - 10.0.2.2 - WARN 
> [net.shibboleth.oidc.security.jose.impl.ClientInformationDataEncryptionAlgorithmsLookupStrategy:116] - No supported data encryption method. Client metadata and configuration are not compatible
> 2024-09-09 15:40:18,373 - 10.0.2.2 - WARN 
> [net.shibboleth.oidc.security.jose.impl.DefaultEncryptionParametersResolver:295] - Validation failure: Failed to resolve an encryption key
> 2024-09-09 15:40:18,374 - 10.0.2.2 - WARN 
> [net.shibboleth.oidc.profile.impl.PopulateJWTEncryptionParameters:294] - 
> Profile Action PopulateJWTEncryptionParameters: Resolver returned no 
> EncryptionParameters
> 2024-09-09 15:40:18,458 - 10.0.2.2 - WARN 
> [org.opensaml.profile.action.impl.LogEvent:101] - A non-proceed event 
> occurred while processing the request: InvalidSecurityConfiguration
> 
> 
> 
>   *
>     i*dp-process.log*
> 
> 
> 2024-09-09 15:40:15,112 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.metadata.impl.StorageServiceClientInformationResolver:77] - Could not find any records with clientId https://REDACTED.csu.edu.au/oidc
> 2024-09-09 15:40:16,246 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTSignatureValidationParametersHandler:130] - Message Handler:  Resolving SignatureValidationParameters for request
> 2024-09-09 15:40:16,248 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.security.jose.impl.BasicSignatureValidationParametersResolver:104] - Resolved JWT SignatureValidationParameters:
> 2024-09-09 15:40:16,248 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.security.jose.impl.BasicSignatureValidationParametersResolver:106] -    Algorithm includes: []
> 2024-09-09 15:40:16,248 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.security.jose.impl.BasicSignatureValidationParametersResolver:107] -    Algorithm excludes: []
> 2024-09-09 15:40:16,249 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.security.jose.impl.BasicSignatureValidationParametersResolver:109] -    SignatureTrustEngine: present
> 2024-09-09 15:40:16,249 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTSignatureValidationParametersHandler:150] - Message Handler:  Resolved SignatureValidationParameters
> 2024-09-09 15:40:16,535 - 10.0.2.2 - INFO 
> [net.shibboleth.idp.plugin.oidc.op.authn.impl.OIDCClientInfoCredentialValidator:152] - Credential Validator oauth2-clientinfo: Login by 'https://REDACTED.csu.edu.au/oidc' succeeded
> 2024-09-09 15:40:16,869 - 10.0.2.2 - INFO 
> [net.shibboleth.idp.authn.impl.FinalizeAuthentication:196] - Profile 
> Action FinalizeAuthentication: Principal https://REDACTED 
> <https://REDACTED>.csu.edu.au/oidc authenticated
> 2024-09-09 15:40:17,144 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.metadata.impl.StorageServiceClientInformationResolver:77] - Could not find any records with clientId https://REDACTED <https://REDACTED>.csu.edu.au/restapi/
> 2024-09-09 15:40:18,227 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTSignatureSigningParameters:230] - Profile Action PopulateJWTSignatureSigningParameters: Signing enabled
> 2024-09-09 15:40:18,227 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTSignatureSigningParametersHandler:256] - Message Handler:  Signing enabled
> 2024-09-09 15:40:18,228 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTSignatureSigningParametersHandler:267] - Message Handler:  Resolving SignatureSigningParameters for request
> 2024-09-09 15:40:18,229 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTSignatureSigningParametersHandler:295] - Message Handler:  Adding metadata to resolution criteria for signing/digest algorithms
> 2024-09-09 15:40:18,229 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTSignatureSigningParametersHandler:302] - Message Handler:  Adding OIDC client information to resolution criteria for signing/digest algorithms
> 2024-09-09 15:40:18,230 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTSignatureSigningParametersHandler:317] - Message Handler:  OIDCProviderMetadataContext is absent
> 2024-09-09 15:40:18,245 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.security.jose.impl.ClientInformationSignatureSigningParametersResolver:101] - No signature algorithm specified in the metadata, using default
> 2024-09-09 15:40:18,250 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.security.jose.impl.BasicSignatureSigningParametersResolver:150] - Resolved SignatureSigningParameters:
> 2024-09-09 15:40:18,250 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.security.jose.impl.BasicSignatureSigningParametersResolver:154] -       Signing credential with key algorithm: RSA
> 2024-09-09 15:40:18,251 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.security.jose.impl.BasicSignatureSigningParametersResolver:159] -       Signature algorithm URI: RS256
> 2024-09-09 15:40:18,251 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTSignatureSigningParametersHandler:350] - Message Handler:  Resolved SignatureSigningParameters
> 2024-09-09 15:40:18,357 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTEncryptionParameters:277] - 
> Profile Action PopulateJWTEncryptionParameters: Resolving 
> EncryptionParameters for 'JWT Access Token' encryption
> 2024-09-09 15:40:18,359 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTEncryptionParameters:328] - 
> Profile Action PopulateJWTEncryptionParameters: Adding OIDC client 
> information to resolution criteria for encryption algorithms
> 2024-09-09 15:40:18,359 - 10.0.2.2 - DEBUG 
> [net.shibboleth.oidc.profile.impl.PopulateJWTEncryptionParameters:344] - 
> Profile Action PopulateJWTEncryptionParameters: 
> OIDCProviderMetadataContext is absent
> 2024-09-09 15:40:18,360 - 10.0.2.2 - WARN 
> [net.shibboleth.oidc.security.jose.impl.ClientInformationKeyTransportEncryptionAlgorithmsLookupStrategy:117] - No supported key transport algorithm. Client metadata and configuration are not compatible
> 2024-09-09 15:40:18,372 - 10.0.2.2 - WARN 
> [net.shibboleth.oidc.security.jose.impl.ClientInformationDataEncryptionAlgorithmsLookupStrategy:116] - No supported data encryption method. Client metadata and configuration are not compatible
> 2024-09-09 15:40:18,373 - 10.0.2.2 - WARN 
> [net.shibboleth.oidc.security.jose.impl.DefaultEncryptionParametersResolver:295] - Validation failure: Failed to resolve an encryption key
> 2024-09-09 15:40:18,374 - 10.0.2.2 - WARN 
> [net.shibboleth.oidc.profile.impl.PopulateJWTEncryptionParameters:294] - 
> Profile Action PopulateJWTEncryptionParameters: Resolver returned no 
> EncryptionParameters
> 2024-09-09 15:40:18,458 - 10.0.2.2 - WARN 
> [org.opensaml.profile.action.impl.LogEvent:101] - A non-proceed event 
> occurred while processing the request: InvalidSecurityConfiguration
> 2024-09-09 15:40:18,784 - 10.0.2.2 - INFO 
> [Shibboleth-Audit.OIDC.Token:338] - 
> 10.0.2.2|2024-09-09T05:40:14.951338Z|2024-09-09T05:40:18.783766Z|https://REDACTED.csu.edu.au/oidc|https://REDACTED.csu.edu.au/oidc|||2024-09-09T05:40:16.550542Z||https://REDACTED.csu.edu.au/oidc||false|||TokenRequest|TokenErrorResponse|||||curl/8.7.1
> 
> 
> 
>   *
>     *../conf/credentials.xml*
> 
>          -->
>      </util:list>
> 
>      <import resource="oidc-credentials.xml"/>
> </beans>
> 
>   *
>     *../conf/oidc.properties*
> 
> # Signing keys for id tokens / userinfo response
> idp.signing.oidc.rs.key = %{idp.home}/credentials/idp-signing-rs.jwk
> idp.signing.oidc.es.key = %{idp.home}/credentials/idp-signing-es.jwk
> # Request object decryption key
> idp.signing.oidc.rsa.enc.key = 
> %{idp.home}/credentials/idp-encryption-rsa.jwk
> 
>   *
>     *metadata*
> 
> tried this
> 
>          <oidcmd:OAuthRPExtensions
>            grant_types="client_credentials"
>            response_types="token"
>            token_endpoint_auth_method="client_secret_post"
>            scopes="profile"
>            id_token_encrypted_response_alg="RSA-SHA256"
>            id_token_encrypted_response_enc="AES256-CBC">
>            
> <saml:Audience>https://archibusqaupgrade.csu.edu.au/restapi/</saml:Audience>
>          </oidcmd:OAuthRPExtensions>
> 
> regards
> 
> Gary
> 
> *Gary Lipscomb*
> 
> Technical Officer, Systems
> 
> IT Infrastructure & Security | Division of Information Technology
> 
> 
> ------------------------------------------------------------------------
> *From:* users <users-bounces at shibboleth.net> on behalf of Henri Mikkonen 
> <henri.mikkonen at nimbleidm.com>
> *Sent:* Wednesday, 4 September 2024 14:28
> *To:* users at shibboleth.net <users at shibboleth.net>
> *Subject:* Re: Configuring OIDC to use client_credentials - 
> InvalidMessageContext
> Hi Gary,
> 
> Ah, now I see how you've defined the audience in the metadata:
> 
> On 4.9.2024 6.25, Lipscomb, Gary wrote:
>  >          <oidcmd:OAuthRPExtensions
>  >            grant_types="client_credentials"
>  >            response_types="token"
>  >            token_endpoint_auth_method="client_secret_post"
>  >            scopes="profile"
>  >            saml:Audience="https://REDACTED.csu.edu.au/restapi/ 
> <https://redacted.csu.edu.au/restapi/>" >
>  >        </oidcmd:OAuthRPExtensions>
> 
> It's supposed to be in a child element, not as an attribute like you've
> done.
> 
> This should work:
> 
> <oidcmd:OAuthRPExtensions
>      grant_types="client_credentials"
>      response_types="token"
>      token_endpoint_auth_method="client_secret_post"
>      scopes="profile">
>      <saml:Audience>https://REDACTED.csu.edu.au/restapi/</saml:Audience>
>    </oidcmd:OAuthRPExtensions>
> 
> BR,
> Henri.
> --
> For Consortium Member technical support, see 
> https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fshibboleth.atlassian.net%2Fwiki%2Fx%2FZYEpPw&data=05%7C02%7Cglipscomb%40csu.edu.au%7C2a14a7f043e7407a619e08dccc9a2022%7Cf0f76207a6104fc0b4a35d797fe5283c%7C0%7C0%7C638610209560769299%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=mILrEXyKCJ5krPr5hpMRZptxpl9NUpxaAg20Th7ESiM%3D&reserved=0 <https://shibboleth.atlassian.net/wiki/x/ZYEpPw>
> To unsubscribe from this list send an email to 
> users-unsubscribe at shibboleth.net
> Charles Sturt University
> 
> Charles Sturt <https://www.csu.edu.au/>
> 
> ------------------------------------------------------------------------
> 
> LEGAL NOTICE
> 
> This email (including correspondence comprising an email chain and any 
> attachment) is confidential and is intended for the use of the 
> addressee(s) only. If you are not the intended recipient of this email, 
> you must not copy, distribute, take any action in reliance on it or 
> disclose it to anyone.
> Any confidentiality is not waived or lost by reason of mistaken 
> delivery. Any email should be checked for viruses and defects before 
> opening. Charles Sturt University does not accept liability for viruses 
> or any consequence which arise as a result of this email transmission. 
> Email communications with Charles Sturt University may be subject to 
> automated email filtering, which could result in the delay or deletion 
> of a legitimate email before it is read at Charles Sturt University. The 
> views expressed in this email are not necessarily those of Charles Sturt 
> University.
> 
> Charles Sturt University in Australia <https://www.csu.edu.au/> The 
> Grange Chancellery, Panorama Avenue, Bathurst NSW Australia 2795 (ABN: 
> 83 878 708 551). Charles Sturt University - TEQSA Provider 
> Identification: PRV12018 (Australian University). CRICOS Provider: 00005F.
> 
> Consider the environment before printing this email.
> 


More information about the users mailing list