-
Notifications
You must be signed in to change notification settings - Fork 275
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
Implement OpenID Connect (OIDC) Possibilities for uPortal(#2587) #2861
Closed
+135
−0
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# OpenID Connect (OIDC) Implementation for uPortal | ||
|
||
## Introduction | ||
OpenID Connect (OIDC) is an authentication layer built on top of OAuth 2.0, enabling clients to verify user identities and obtain basic profile information. This documentation outlines the OIDC possibilities, including available endpoints, group and claims filters, and using OAuth endpoints for clients. | ||
|
||
## OIDC Endpoints | ||
|
||
### 1. Authorization Endpoint | ||
- **Purpose**: Initiates the OIDC flow by redirecting users to the login page. | ||
- **HTTP Method**: GET | ||
- **Example**: | ||
``` | ||
GET /authorize?response_type=code&client_id={client_id}&redirect_uri={redirect_uri}&scope={scope}&state={state} | ||
``` | ||
- **Parameters**: | ||
- `response_type`: The response type, e.g., `code`. | ||
- `client_id`: The client identifier. | ||
- `redirect_uri`: The redirection URI. | ||
- `scope`: The scope of the access request. | ||
- `state`: An opaque value used to maintain state between the request and callback. | ||
|
||
### 2. Token Endpoint | ||
- **Purpose**: Exchanges the authorization code for an access token. | ||
- **HTTP Method**: POST | ||
- **Example**: | ||
``` | ||
POST /token | ||
Content-Type: application/x-www-form-urlencoded | ||
{ | ||
"grant_type": "authorization_code", | ||
"code": "{authorization_code}", | ||
"redirect_uri": "{redirect_uri}", | ||
"client_id": "{client_id}", | ||
"client_secret": "{client_secret}" | ||
} | ||
``` | ||
- **Parameters**: | ||
- `grant_type`: The type of the grant, e.g., `authorization_code`. | ||
- `code`: The authorization code received from the authorization server. | ||
- `redirect_uri`: The redirection URI used in the initial request. | ||
- `client_id`: The client identifier. | ||
- `client_secret`: The client secret. | ||
|
||
### 3. UserInfo Endpoint | ||
- **Purpose**: Retrieves user information based on the access token. | ||
- **HTTP Method**: GET | ||
- **Example**: | ||
``` | ||
GET /userinfo | ||
Authorization: Bearer {access_token} | ||
``` | ||
- **Headers**: | ||
- `Authorization`: The access token obtained from the token endpoint. | ||
|
||
### 4. End Session Endpoint | ||
- **Purpose**: Logs the user out of the OIDC provider. | ||
- **HTTP Method**: GET | ||
- **Example**: | ||
``` | ||
GET /logout?post_logout_redirect_uri={redirect_uri}&id_token_hint={id_token} | ||
``` | ||
- **Parameters**: | ||
- `post_logout_redirect_uri`: The URI to redirect to after logout. | ||
- `id_token_hint`: The ID token previously issued to the user. | ||
|
||
## Group and Claims Filters | ||
|
||
### Group Filters | ||
- **Description**: Specify which user groups are included in the OIDC token. | ||
- **Example**: | ||
```json | ||
"groups": ["admin", "user"] | ||
``` | ||
|
||
### Claims Filters | ||
- **Description**: Define which claims are returned in the ID token or access token. | ||
- **Example**: | ||
Comment on lines
+75
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it looks like the markdown formatting got messed up here |
||
```json | ||
"claims": { | ||
"email": { "essential": true }, | ||
"role": { "values": ["admin", "user"] } | ||
} | ||
``` | ||
|
||
## Using OAuth for Clients | ||
|
||
### Client Registration | ||
- **Process**: Clients must register with the OIDC provider to obtain a client ID and secret. | ||
- **Steps**: | ||
1. Access the client registration endpoint. | ||
2. Provide required details such as client name and redirect URIs. | ||
3. Obtain the client ID and secret. | ||
|
||
### Scopes and Permissions | ||
- **Definition**: Scopes determine the level of access requested by the client. | ||
- **Example**: | ||
```json | ||
"scope": "openid profile email" | ||
``` | ||
- **Common Scopes**: | ||
- `openid`: Required to perform OIDC authentication. | ||
- `profile`: Requests access to the user's profile information. | ||
- `email`: Requests access to the user's email address. | ||
Comment on lines
+94
to
+103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uPortal has custom claims, this looks like generic OIDC |
||
|
||
### Token Retrieval Process | ||
- **Steps**: Clients obtain access tokens to access protected resources. | ||
- **Example**: | ||
``` | ||
POST /token | ||
Content-Type: application/x-www-form-urlencoded | ||
{ | ||
"grant_type": "client_credentials", | ||
"client_id": "{client_id}", | ||
"client_secret": "{client_secret}", | ||
"scope": "{scope}" | ||
} | ||
``` | ||
- **Parameters**: | ||
- `grant_type`: The type of the grant, e.g., `client_credentials`. | ||
- `client_id`: The client identifier. | ||
- `client_secret`: The client secret. | ||
- `scope`: The scope of the access request. | ||
|
||
## Additional Security Considerations | ||
- **Token Expiration**: Always check the expiration time of tokens and renew them as needed. | ||
- **Revocation**: Implement token revocation to invalidate tokens when necessary. | ||
- **Secure Storage**: Store client secrets and tokens securely to prevent unauthorized access. | ||
|
||
## References | ||
- [OIDC Official Documentation](https://openid.net/developers/specs/) | ||
- [OAuth 2.0 Specification](https://oauth.net/2/) | ||
- [uPortal Documentation](https://apereo.github.io/uPortal/) | ||
|
||
## Conclusion | ||
This documentation serves as a comprehensive guide for developers to understand and implement OIDC using OAuth 2.0 in uPortal, facilitating secure user authentication and resource access. | ||
555vedant marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't think this needs an introduction, we can link out to the official OIDC docs or wikipedia for this.
Also uPortal specifically uses form of three legged auth, which doesn't seem to be referenced anywhere