Configuring OIDC to use client_credentials - InvalidMessageContext

Lipscomb, Gary glipscomb at csu.edu.au
Wed Sep 4 03:25:42 UTC 2024


Hi Henri,

Thanks for trying to help but I still haven't got it working. I had the 2nd metadata file already but simplified it to that shown below.
I'm still getting the error "no allowed audience"


  *
Test code

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 resource=https://REDACTED.csu.edu.au/restapi/        \
--data-urlencode scope=profile

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


  *
idp-process.log

2024-09-04 12:55:50,964 - 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-04 12:55:51,035 - 10.0.2.2 - WARN [org.opensaml.profile.action.impl.LogEvent:101] - A non-proceed event occurred while processing the request: InvalidTarget

  *
Metadata 1

<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="profile"
          saml:Audience="https://REDACTED.csu.edu.au/restapi/" >
      </oidcmd:OAuthRPExtensions>
    </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>


  *
Metadata 2

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

  <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:PrivacyStatementURL xml:lang="en">https://www.csu.edu.au/about-csu</mdui:PrivacyStatementURL>
      </mdui:UIInfo>
      <oidcmd:OAuthRPExtensions
          scopes="profile">
      </oidcmd:OAuthRPExtensions>
    </md:Extensions>
    <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>

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: Tuesday, 3 September 2024 20:17
To: users at shibboleth.net <users at shibboleth.net>
Subject: Re: Configuring OIDC to use client_credentials - InvalidMessageContext

Hi Gary,

On 3.9.2024 4.07, Lipscomb, Gary via users wrote:
> 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"}

The correct parameter-name is 'resource', not 'audience'. See
https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdatatracker.ietf.org%2Fdoc%2Fhtml%2Frfc8707&data=05%7C02%7Cglipscomb%40csu.edu.au%7C5fff901400b14f453a6b08dccc019aa8%7Cf0f76207a6104fc0b4a35d797fe5283c%7C0%7C0%7C638609556253371905%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C60000%7C%7C%7C&sdata=cVTeMQaVyOGXct%2FZSZU1m4c8LnB2I4m8E%2FS3dB1nKYI%3D&reserved=0<https://datatracker.ietf.org/doc/html/rfc8707>

> *saml:Audience="https://REDACTED.csu.edu.au/restapi<https://redacted.csu.edu.au/restapi>" />*

Do you also have a trusted metadata entry for
'https://REDACTED.csu.edu.au/restapi<https://redacted.csu.edu.au/restapi>'?

As you seem to be using SAML metadata, you need a specific
EntityDescriptor entry for it. A minimal example with the scope that you
used in the curl-command above:

<md:EntityDescriptor entityID="https://REDACTED.csu.edu.au/restapi<https://redacted.csu.edu.au/restapi>">
   <md:SPSSODescriptor
xmlns:oidcmd="urn:mace:shibboleth:metadata:oidc:1.0"
protocolSupportEnumeration="https://aus01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fopenid.net%2Fspecs%2Fopenid-connect-core-1_0.html&data=05%7C02%7Cglipscomb%40csu.edu.au%7C5fff901400b14f453a6b08dccc019aa8%7Cf0f76207a6104fc0b4a35d797fe5283c%7C0%7C0%7C638609556253384144%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C60000%7C%7C%7C&sdata=mxwhjPd0HlQRW9g2UhOt4NvZfb6fxyb3q0qZzvJ9iF4%3D&reserved=0">
     <md:Extensions>
       <oidcmd:OAuthRPExtensions
         scopes="profile">
       </oidcmd:OAuthRPExtensions>
     </md:Extensions>
   </md:SPSSODescriptor>
</md:EntityDescriptor>

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%7C5fff901400b14f453a6b08dccc019aa8%7Cf0f76207a6104fc0b4a35d797fe5283c%7C0%7C0%7C638609556253391832%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C60000%7C%7C%7C&sdata=sxokmsdmbDRCsVtyoF70%2FrHPhDpmST9ex%2BL6WUvvQ%2BI%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/20240904/8da2fd14/attachment.htm>


More information about the users mailing list