Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding implicit scopes broken for clients requiring consent #98

Closed
rhafer opened this issue Jun 1, 2023 · 2 comments
Closed

Adding implicit scopes broken for clients requiring consent #98

rhafer opened this issue Jun 1, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@rhafer
Copy link
Contributor

rhafer commented Jun 1, 2023

I've been trying to implicitly add the LibgreGraph.UUID scope (to always get the lg.uuid claim added to tokens and userinfo) to our client configuration. But it breaks as soon as the client requires consent. (E.g. because trusted is not set to true or when the client sends prompts=consent with the authentication request.

E.g. this (trusted) client config works and successfully includes the lg.uuid claim in the response:

- id: works
  name: ownCloud Web app
  trusted: true
  implicit_scopes:
  - LibgreGraph.UUID
  secret: ""
  redirect_uris:
  - http://127.0.0.1
  - http://localhoyst
  origins: []
  application_type: native

while this one does not (only difference is the missing trusted: true:

- id: broken
  name: ownCloud Web app
  implicit_scopes:
  - LibgreGraph.UUID
  secret: ""
  redirect_uris:
  - http://127.0.0.1
  - http://localhost
  origins: []
  application_type: native

How to reproduce

Start lico using the clients registry from https://gist.github.com/rhafer/8f94d55d39332589ba0cb80fd6c1b2ce#file-identifier-registration-yaml

export LDAP_UUID_ATTRIBUTE=entryUUID
export LDAP_....
bin/licod serve --listen 0.0.0.0:9200 \
    --iss=https://ocis.owncloud.test \
    --signing-private-key private-key.pem \
    --encryption-secret encryption.key ldap  \
    --identifier-client-path identifier/build/ \
    --log-level debug \
    --identifier-registration-conf ~/.ocis/idp/tmp/identifier-registration.yaml

I used a slightly modified version of the go-oidc userinfo sample: https://gist.github.com/rhafer/8f94d55d39332589ba0cb80fd6c1b2ce#file-userinfo-go
which basically just return the userinfo of the authenticated user.

Just copied it into example/userinfo/app.go of a local clone of https://github.com/coreos/go-oidc and run it with:

CLIENT_ID=works go run example/userinfo/app.go

and point your brower to http://127.0.0.1:5556 (ideally a private window) with CLIENT_ID=works the browser should display the userinfo including the lg.uuid claim (provided the used LDAP server returns and entryUUID attribute for the user.

To reproduce the error use CLIENT_ID=broken go run example/userinfo/app.go and open a new private session in the browser.
This time you should be prompted for consent and now the lg.uuid claim is missing from the userinfo. Shouldn't the implict_scopes always be include regardless of the given consent? Or alternatively shouldn't the consent page request consent for that scope if it's part of the implict scopes?

BTW, the problem is also reproducible for trusted clients that require consent. See line 82 on the example app.

@longsleep
Copy link
Collaborator

I have not looked at the details yet but reading this makes me think that the "implicit scopes" are implicitly added client scopes (as if the client would have requested them) but does not implicitly give a grant to get those claims.

So maybe "somewhere on the way through consent" the implicit scopes are lost (as the client never added them, this might be simply be an oversight that the implicit scopes are not used when requesting consent).

Needs investigation in the code.

@longsleep
Copy link
Collaborator

I tried to reproduce this now and it works just fine for me.

The implicit scope ends up in the access token scp claim.

"scp": "email LibgreGraph.UUID openid profile",

Then also the response to the userinfo endpoint does include the lg.uuid claims as expected:

"lg.uuid": "L289TXkgRXhjaGFuZ2UgNCBBbGwvL2NuPTE0MDAwMDAwMDYwMDAwMDAtdXNlcjE",

The identifier registration looks like this:

clients:
  - id: playground.js
    name: OIDC Playground
    application_type: web
    implicit_scopes:
      - LibgreGraph.UUID
    redirect_uris:
      - https://mose4:8509/

So things seem to be fine. It has been a while since this issue was opened, so closing this here for now. If this should be still an issue please reopen for further investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants