IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

AllowUnrestrictedIntrospection support

Open madsj opened this issue 9 years ago • 13 comments

I can see that the AllowUnrestrictedIntrospection that was supported in Scope has been removed in ApiResource. As far as I can see then that feature has been removed for introspect.

Or are there still a supported way to get the introspect to return all scopes from AccessToken?

madsj avatar Mar 08 '17 13:03 madsj

yes - should work by default now. Do you have issues with it?

leastprivilege avatar Mar 09 '17 07:03 leastprivilege

yes it seems that I have an issue.

My AccessToken has:

"scope": [
    "api1",
    "api2",
    "offline_access"
  ]

The introspect returns

{{
  "nbf": 1489061855,
  "exp": 1489065455,
  "iss": "http://localhost:1941",
  "aud": [
    "http://localhost:1941/resources",
    "api1",
    "api2"
  ],
  "client_id": "roclient",
  "sub": "2",
  "auth_time": 1489061855,
  "idp": "local",
  "amr": "pwd",
  "scope": "api1",
  "active": true
}}

So the scope only contains "api1"

My client has the following settings:

                UpdateAccessTokenClaimsOnRefresh = true,
                AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
                AllowOfflineAccess = true,
                RefreshTokenUsage= TokenUsage.OneTimeOnly,
                AllowedScopes = { "api1", "api2" }

My apis is

new ApiResource("api1", "My API") {
   ApiSecrets = { apiSecret }
},
new ApiResource("api2", "My API") {
 ApiSecrets = { apiSecret }
 }

madsj avatar Mar 09 '17 12:03 madsj

IIRC this is by design - you can only see the scopes of the API used to introspect the token.

Why do you need the other scopes?

leastprivilege avatar Mar 09 '17 12:03 leastprivilege

yeah I know that this is by design but if i remember correctly you added AllowUnrestrictedIntrospection that implied all scopes was returned in introspect.

https://github.com/IdentityServer/IdentityServer3/issues/2291

We have an api where we by introspect checks if the AccessToken is correct and then beside that scope the AccessToken also needs to have another scope.

As a workaround right now we are first by introspect validating the AccessToken and then parsing the scopes in the AccessToken.

madsj avatar Mar 09 '17 13:03 madsj

We are planning on making the introspection endpoint more flexible. Right now I don't have a workaround for besides defining all the needed scopes in a single API resource.

leastprivilege avatar Mar 16 '17 05:03 leastprivilege

okay. Thanks for fast reply

madsj avatar Mar 16 '17 07:03 madsj

Hi - is there a plan to add AllowUnrestrictedIntrospection back in IdS4?

Thanks.

mosdevid avatar Apr 27 '17 17:04 mosdevid

In 2.0 you will be able to tweak the default behavior.

leastprivilege avatar Apr 28 '17 04:04 leastprivilege

Actually - this is already implemented if you want to use our nightly builds.

leastprivilege avatar Apr 28 '17 04:04 leastprivilege

Thanks for your response. I looked around the code but didn't see anything to that affect. Just to make sure, you are saying that the latest code will allow introspecting all the scopes in the token (from all the ApiResources) using one of the ApiResources' secret?

Thanks.

mosdevid avatar Apr 29 '17 04:04 mosdevid

You can implement your own (or derive from our) IIntrospectionResponseGenerator - this gives you full control over what data should get returned.

leastprivilege avatar May 01 '17 11:05 leastprivilege

Got it - thanks!

mosdevid avatar May 01 '17 17:05 mosdevid

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 14 '20 18:01 lock[bot]