Configuring OIDC to use client_credentials - InvalidMessageContext

Henri Mikkonen henri.mikkonen at nimbleidm.com
Thu Aug 29 06:45:15 UTC 2024


Hi Gary,

I was finally able to reproduce the behaviour with the following remarks:

- scope 'openid' is registered in the metadata (like you do) and also 
requested by the client. This is the main reason for the confusing logs: 
the current code is using that scope to signal the use of OpenID Connect 
sequence, which is never the case with the client credentials grant. If 
you remove the use of that scope, you'll probably see error message with 
description "Improper or disallowed resource indicator".

- The error description above is related to the lack of using resource 
indicator in the request, or the client does not have any registered 
audiences. See 
https://shibboleth.atlassian.net/wiki/spaces/SC/pages/1912406916/OAuthRPMetadataProfile 
. The logic is that unless the client requests any specific resource, 
the first registered audience is used as the access token 
target/audience. In any case, the registered resources need to have 
OAUTH2.TokenAudience profile enabled. You should have that covered as 
you've enabled it via DefaultRelyingParty.

Regarding the scopes, until OP 4.1.0 you need to be using some scope 
value in the request. See https://shibboleth.atlassian.net/browse/JOIDC-176

BR,
Henri.

On 29.8.2024 5.58, Lipscomb, Gary via users wrote:
> Hi List,
> 
> Environment
> 
>   *
>     RHEL 8
>   *
>     IdP 4.3.3  (currently  migrating to 5.1.3)
>   *
>     Plugins
>       o
>         Plugin: net.shibboleth.oidc.common      Current Version: 2.2.1
>       o
>         Plugin: net.shibboleth.idp.plugin.oidc.config   Current Version:
>         1.0.1
>       o
>         Plugin: net.shibboleth.idp.plugin.oidc.op       Current Version:
>         3.4.0
>   *
>     Java openjdk version "11.0.24"
> 
> I think I've got the authentication working but I'm getting this in the log
> 
> 2024-08-29 10:13:54,603 - IP REDACTED - 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-08-29 10:13:54,603 -IP REDACTED - INFO 
> [net.shibboleth.idp.authn.impl.FinalizeAuthentication:196] - Profile 
> Action FinalizeAuthentication: Principal https://REDACTED 
> <https://REDACTED>.csu.edu.au/oidc authenticated
> 2024-08-29 10:13:54,604 - IP REDACTED - ERROR 
> [net.shibboleth.idp.plugin.oidc.op.profile.impl.InitializeRelyingPartyContext:144] - resource/audience ID Unable to obtain Profile Action InitializeRelyingPartyContext:
> 2024-08-29 10:13:54,605 - IP REDACTED - WARN 
> [org.opensaml.profile.action.impl.LogEvent:101] - A non-proceed event 
> occurred while processing the request: I*nvalidMessageContext*
> 2024-08-29 10:13:54,606 -IP REDACTED - INFO 
> [Shibboleth-Audit.OIDC.Token:338] - 
> 54.86.50.139|2024-08-29T00:13:54.582866Z|2024-08-29T00:13:54.606339Z|https://REDACTED.csu.edu.au/oidc|https://archibusqaupgrade.csu.edu.au/oidc|||2024-08-29T00:13:54.603402Z||https://REDACTED.csu.edu.au/oidc||false|||TokenRequest|TokenErrorResponse|||||PostmanRuntime/7.41.2
> 
> I've added
>                  <ref bean="OAUTH2.Token" />
>                  <ref bean="OAUTH2.TokenAudience" />
> to the DefaultRelyingParty and my RelyingPartyOverrides but not to the 
> UnverifiedRelyingParty
> 
> The SP information is held in metadata
>          <oidcmd:OAuthRPExtensions
>            grant_types="client_credentials"
>            response_types="code token id_token"
>            token_endpoint_auth_method="client_secret_post"
>            scopes="openid profile" />
>        </md:Extensions>
> 
> 
> Any help on troubleshooting would be greatly appreciated
> 
> regards
> 
> Gary
> 
> *Gary Lipscomb*
> 
> Technical Officer, Systems
> 
> IT Infrastructure & Security | Division of Information Technology
> 
> Charles Sturt University, Bathurst, NSW 2795
> 
> 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