Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Add Client Specific Subjects in Claims #1557

Closed
DerAlbertCom opened this issue Sep 24, 2017 · 16 comments
Closed

Add Client Specific Subjects in Claims #1557

DerAlbertCom opened this issue Sep 24, 2017 · 16 comments

Comments

@DerAlbertCom
Copy link
Contributor

Currently every Client get's the same Subject for the User. And this is in case if ASP.NET Identity the UserId. So this is a little Information leaked.

Please add an option (Global and/or per Client) so that it is possible to send a client specific Subject to the client.

From my investigation this can be achieved by DefaultClaimsService which make a (subjectId+clientId).Sha256()

And also

if (subject.GetSubjectId() != subClaim.Value)

must be changed to recreate the hash, and check for this.

Other Places?

Now seems the time to add this, because 2.0 is not yet released. I willing to implement this.

@TomCJones
Copy link

TomCJones commented Sep 24, 2017 via email

@leastprivilege
Copy link
Member

Yes - we are interested in implementing pairwise subject identifier. It's been on our todo list for a long time.

@DerAlbertCom If you are interested in this - we can start a discussion. This won't happen for 2.0 anymore though.

@TomCJones
Copy link

TomCJones commented Sep 25, 2017 via email

@DerAlbertCom
Copy link
Contributor Author

I've read through the specs (http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes).

So, basicly (sector_identifier+account_id+salt) then using SHA or AES. I'm for SHA, don't see really additional security in AES here. Performancewise SHA should be faster, but it think in general the generation and validation of the pairwise subject id is not a performance problem. And on the IdentityServer side we have all needed Information to recreate the hash.

I have have some problems with the specs, because the sector_identifier should be either a sector_identifier_uri, or a redirect_uri (if only one is present). But with these kind identifiers a Client cannot be moved to another domain (renaming company, mergers, product changes etc.).

So, the questions i have. Should we go to the "trouble" with a sector_identitier_url or just simply use a simpler sector_identifier (like clientid) instead of a volatile redirect_uri? The sector_identitifer_uri seems not commonly in use. And if we do this, this may be optional. If the client want's to use redirect_uri or sector_identifier then it will be used, otherwise the clientid.

I think this is also in the specs, because the example 3 for creating the subject is about generated GUIDs as sector_identifier.

Also, as I understand the spec ist that the IdServer should announce the availability of the paire_wise subject. And then the Client MAY opt in for pair wise subject, this should an opt out. But the client registration is not a part of IdServer4, so no problem on that side ;)

@brockallen
Copy link
Member

We should add the extra property needed to Client now for 2.0 if we're going to do this.

@DerAlbertCom
Copy link
Contributor Author

First suggestion

  • SectorIdentitierUri
  • SectorId (if we don't go with ClientId)
  • PairWiseSubjectSalt
  • EnablePairWiseSubject

@TomCJones
Copy link

I reread the pairwise section.
It is unclear if sector ID is required because of the odd mixture and must and should.
Sector ID is not needed in my application and it will not support sectors in my OP database.
It seems unclear what would happen if sectors were presented by (one of) the client in one case and not in another.
I guess it is a judgement call on sector ID.

@leastprivilege
Copy link
Member

We will discuss this...

@brockallen
Copy link
Member

I think we'll start with adding PairWiseSubjectSalt whose semantics are that if it's null then we do what we already do today, and if it's non-null then we use it to calculate a pair-wise subject id. We'll add the property for 2.0, and in 2.1 we'll actually implement it. And if you want to do the work on it @DerAlbertCom , then let's start a issue/PR to discuss.

@brockallen
Copy link
Member

Ok, I've added the property. The next thing is for 2.1 to add the implementation. For now, I'll mark this as a 21. enhancement. If you want to start on a PR, you can @DerAlbertCom .

@brockallen brockallen added this to the 2.1 milestone Sep 29, 2017
@DerAlbertCom
Copy link
Contributor Author

DerAlbertCom commented Oct 1, 2017

For clarification.

Following things must be done for this.

  1. Adapt DefaultClaimsService to calculate the pair wise subject (with the usage of a IPairWiseSubjectService?)?
  2. Change EndSessionRequest Validator, to validator the pair wise subject.
  3. Announce the availability of pair wise subject in the metadata

The Pairwise Subject could be calculate with

a. (subject+salt).Sha256() as base64
or
b. pbkdf2(subject, salt, 10000) as base64

a. should be enough.

@leastprivilege leastprivilege removed this from the 2.1 milestone Dec 27, 2017
@leastprivilege leastprivilege added this to the 2.2 milestone Jan 5, 2018
@brockallen brockallen modified the milestones: 2.2, 3.0 Apr 3, 2018
@brockallen
Copy link
Member

Marking as 3.0 since we anticipate breaking changes. I think we all knew this, but just doing it for formality.

@DerAlbertCom
Copy link
Contributor Author

I'm ok with that. On the current project we are far away from connection external clients, and this is the main need for that feature in my point of view.

kinosang added a commit to kinosang/IdentityServer4 that referenced this issue Jan 20, 2019
kinosang added a commit to kinosang/IdentityServer4 that referenced this issue Jan 20, 2019
kinosang added a commit to kinosang/IdentityServer4 that referenced this issue Jan 20, 2019
kinosang added a commit to kinosang/IdentityServer4 that referenced this issue Jan 20, 2019
kinosang added a commit to kinosang/IdentityServer4 that referenced this issue Jan 20, 2019
@kinosang
Copy link

kinosang commented Jan 20, 2019

One more question, how can we retrieve the user information when we use pairwise subject? Should we add a new table to store these pairwise subject?

@brockallen brockallen modified the milestones: 4.0, Future Dec 10, 2019
@stale
Copy link

stale bot commented Jan 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions
Copy link

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants