Configuring OIDC to use client_credentials - InvalidMessageContext

Lipscomb, Gary glipscomb at csu.edu.au
Tue Sep 3 01:07:01 UTC 2024


Hi Henri,

I must be missing something but can't work it out


  *
Testing Script

curl -k --location https://idpqa.csu.edu.au/idp/profile/oidc/token --header "Content-Type: application/x-www-form-urlencoded" --data-urlencode grant_type=client_credentials --data-urlencode client_id=https://REDACTED.csu.edu.au/oidc --data-urlencode client_secret=REDACTED_SECRET --data-urlencode audience=https://REDACTED.csu.edu.au/restapi --data-urlencode scope=profile

{"error":"invalid_target","error_description":"Improper or disallowed resource indicator"}


  *
Metadata

<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
                  xmlns:oidcmd="urn:mace:shibboleth:metadata:oidc:1.0"
                  xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                  entityID="https://REDACTED.csu.edu.au/oidc">

    <md:SPSSODescriptor  protocolSupportEnumeration="http://openid.net/specs/openid-connect-core-1_0.html">
      <md:Extensions>
        <mdui:UIInfo xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui">
          <mdui:DisplayName xml:lang="en">REDACTED RestAPI - QA</mdui:DisplayName>
          <mdui:Description xml:lang="en">REDACTED RestAPI - QA</mdui:Description>
        </mdui:UIInfo>
        <oidcmd:OAuthRPExtensions
          grant_types="client_credentials"
          response_types="token"
          token_endpoint_auth_method="client_secret_post"
          scopes="email profile"
          saml:Audience="https://REDACTED.csu.edu.au/restapi" />
    </md:Extensions>
      <md:KeyDescriptor>
        <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <oidcmd:ClientSecret>REDACTED_SECRET</oidcmd:ClientSecret>
        </ds:KeyInfo>
      </md:KeyDescriptor>

      <md:NameIDFormat>urn:mace:shibboleth:metadata:oidc:1.0:nameid-format:public</md:NameIDFormat>
      <md:AssertionConsumerService Binding="https://tools.ietf.org/html/rfc6749#section-3.1.2"
                                     Location="https://REDACTED.csu.edu.au/restapi"
                                     index="1" />
    </md:SPSSODescriptor>
</md:EntityDescriptor>


  *
IdP Process Log

2024-09-03 09:51:02,940 - 10.0.2.2 - INFO [net.shibboleth.idp.authn.impl.FinalizeAuthentication:196] - Profile Action FinalizeAuthentication: Principal https://REDACTED.csu.edu.au/oidc authenticated
2024-09-03 09:51:02,941 - 10.0.2.2 - DEBUG [net.shibboleth.idp.plugin.oidc.op.profile.impl.SetAuthenticationContextClassReferenceToResponseContext:136] - Profile Action SetAuthenticationContextClassReferenceToResponseContext: Setting acr based on performed flow
2024-09-03 09:51:02,942 - 10.0.2.2 - DEBUG [net.shibboleth.idp.plugin.oidc.op.profile.impl.SetAuthenticationTimeToResponseContext:76] - Profile Action SetAuthenticationTimeToResponseContext: Setting authentication time to 2024-09-02T23:51:02.867730Z
2024-09-03 09:51:02,969 - 10.0.2.2 - DEBUG [net.shibboleth.idp.plugin.oidc.op.profile.impl.SetSectorIdentifierForAttributeResolution:89] - Profile Action SetSectorIdentifierForAttributeResolution: Attribute recipient group id set to value public for generating subject of type public
2024-09-03 09:51:03,035 - 10.0.2.2 - WARN [net.shibboleth.idp.plugin.oidc.op.oauth2.profile.impl.ValidateAudience:198] - Profile Action ValidateAudience: No allowed audience for client https://REDACTED.csu.edu.au/oidc
2024-09-03 09:51:03,051 - 10.0.2.2 - WARN [org.opensaml.profile.action.impl.LogEvent:101] - A non-proceed event occurred while processing the request: InvalidTarget
2024-09-03 09:51:03,080 - 10.0.2.2 - DEBUG [net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractBuildErrorResponseFromEvent:156] - Profile Action BuildTokenErrorResponseFromEvent: Found mapped event for InvalidTarget
2024-09-03 09:51:03,080 - 10.0.2.2 - DEBUG [net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractBuildErrorResponseFromEvent:166] - Profile Action BuildTokenErrorResponseFromEvent: ErrorResponse successfully set as the outbound message
2024-09-03 09:51:03,146 - 10.0.2.2 - INFO [Shibboleth-Audit.OIDC.Token:338] - 10.0.2.2|2024-09-02T23:51:02.497526Z|2024-09-02T23:51:03.146017Z|https://REDACTED.csu.edu.au/oidc|https://REDACTED.csu.edu.au/oidc|||2024-09-02T23:51:02.867730Z||https://REDACTED.csu.edu.au/oidc||false|||TokenRequest|TokenErrorResponse|||||curl/8.7.1
2024-09-03 09:51:03,146 - 10.0.2.2 - DEBUG [net.shibboleth.idp.profile.impl.RecordResponseComplete:89] - Profile Action RecordResponseComplete: Record response complete


  *
Environment
     *
RHEL 8
     *
IdP 4.3.3  (currently  migrating to 5.1.3)
     *
Plugins
        *
Plugin: net.shibboleth.oidc.common      Current Version: 2.2.1
        *
Plugin: net.shibboleth.idp.plugin.oidc.config   Current Version: 1.0.1
        *
Plugin: net.shibboleth.idp.plugin.oidc.op       Current Version: 3.4.0
     *
Java openjdk version "11.0.24"




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: Friday, 30 August 2024 17:14
To: users at shibboleth.net <users at shibboleth.net>
Subject: Re: Configuring OIDC to use client_credentials - InvalidMessageContext

On 30.8.2024 8.44, Lipscomb, Gary wrote:
> Hi Henri,
>
> Still no success
>
> I'm using this to test
>
> curl --location https://REDACTED/idp/profile/oidc/token --header
> "Content-Type: application/x-www-form-urlencoded" --header "Accept:
> application/json" --data-urlencode grant_type=client_credentials
> --data-urlencode client_id=https://REDacted/oidc --data-urlencode
> client_secret=VERY_VERY_SECRET  --data-urlencode scope=openid

That's expected as you still seem to have the scope=openid in the
parameters. You shouldn't use that specific scope with any non-OIDC
sequence such as client_credentials grant.

I filed an issue about it
https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fshibboleth.atlassian.net%2Fbrowse%2FJOIDC-224&data=05%7C02%7Cglipscomb%40csu.edu.au%7Cfc2e50419bd54901a66e08dcc8c3808d%7Cf0f76207a6104fc0b4a35d797fe5283c%7C0%7C0%7C638605989217533999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=QUVdj3Z7FVQMoMzxiJjcwKjvH7vTCHnYIEc5ONPosLE%3D&reserved=0<https://shibboleth.atlassian.net/browse/JOIDC-224> to improve logging.
But in any case, you need to add the audience to the client metadata in
order to have a target for the access token to be issued with the client
credentials grant.

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%7Cfc2e50419bd54901a66e08dcc8c3808d%7Cf0f76207a6104fc0b4a35d797fe5283c%7C0%7C0%7C638605989217552771%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=DT3tbQ%2Bf7fV%2BhqhAQqL%2BWU%2FQmUJTgZexE3COK5zs5q8%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]<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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20240903/24d3073d/attachment.htm>


More information about the users mailing list