-
Notifications
You must be signed in to change notification settings - Fork 3
Add support for MultiClientID Authenticators. #22
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
Conversation
- The auth interceptor will choose an authenticator based on the issuer and configured clientID combination. - From the token the clientID is checked from the audience field of the claim. - Since audience can contain more than just the clientID, the multi authenticator does a "Contains" check for the configured clientID and the audience field. Signed-off-by: Aditya Dani <[email protected]>
pkg/auth/multiauthenticator.go
Outdated
|
|
||
| type IssuerWithClientID struct { | ||
| Issuer string // Issuer of the token. | ||
| ClientID string // ClientID of the token, can be empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a comment to indicate what it means to have an empty ClientID. This was not obvious to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the comment and added an explicit check to fail if clientID is found to be empty. This behavior is clearer as compared to allowing empty clientIDs. Another thought is this multi authenticator really makes sense only for OIDC authenticators where we definitely need a clientID to verify the token. May be we could rename this to OIDCMultiAuthenticatorsWithClientID or so
d1c16e7 to
d82a208
Compare
d82a208 to
8d5149b
Compare
Signed-off-by: Aditya Dani <[email protected]>
79c1c8d to
f9abb7f
Compare
| assert.Equal(t, "my-name", authenticateClaims.Name) | ||
| assert.Equal(t, []string{"tester"}, authenticateClaims.Roles) | ||
|
|
||
| rawToken2, err := Token(&Claims{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rawToken2 looks the same as rawToken1. What are we testing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The signature key is different my-secret-2. Basically trying to test both authenticators from the same issuer are being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, should rawToken1 use "my-secret-1" on line 106? It says "my-secret-2".
- Create a list of authenticators for each issuer. Remove the requirement for providing a clientID. - This allows adding self signed authenticators to the same multi authenticators interface. Signed-off-by: Aditya Dani <[email protected]>
Signed-off-by: Aditya Dani <[email protected]>
What this PR does / why we need it:
Which issue(s) this PR fixes (optional)
Closes #
Special notes for your reviewer: