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

Implement RAS Authentication Provider #195

Merged
merged 31 commits into from
Aug 22, 2024
Merged

Implement RAS Authentication Provider #195

merged 31 commits into from
Aug 22, 2024

Conversation

Gcolon021
Copy link
Contributor

@Gcolon021 Gcolon021 commented Aug 2, 2024

  • Create OktaAuthenticationService by extracting generic OKTA authentication code.
  • Create & Implement RASAuthenticationService and RASAuthenticationServiceTest.
  • Create & Implement RASPassportService and RASPassportServiceTest.
  • Implement RAS Passport handling and polling.
    • Add new enum for potential passport validation responses. This is used to ensure all potential return values are handled with in a switch statement.
  • Add model for RAS Passport and RAS Visas.
  • Add Passport property to User entity.
    • Includes a corresponding migration script to add new column to database.
  • Add new methods to the JWTUtil class to assist with decoding and parsing RAS Passports which use a JWT format.
  • Included SessionService for session management with caching support.

Create OktaAuthenticationService to extract OKTA implementation. Added RASAuthenticationService and RASPassportService. Implement RAS Passport handling and polling. Added SessionService for session management with caching support. Implemented unit tests for RASAuthenticationService and RASPassPortService to validate RAS authentication flows and passport handling.
@Gcolon021 Gcolon021 self-assigned this Aug 2, 2024
@Gcolon021 Gcolon021 added the enhancement New feature or request label Aug 2, 2024
Introduced a set to track public access roles in `RoleService` and automatically assign these roles to users in `UserService`. This ensures every user has access to public datasets by default.
We no longer use the security context to retrieve the user. We now use the authentication token. This ensures we don't have lazy loading exceptions associated with the previous approach.
Extracted expired visa validation from `validateVisa` method to simplify the logic and duty separation. Modified tests to use a parsed visa for more accurate validation simulations. Added placeholder `updateExpirationTime` method to JWTUtil for future use.
Extend the `CustomLogoutHandler` to remove the user's passport upon logout by calling the new `removeUserPassport` method in `UserService`.
This update introduces checks for RAS passport validity, including expiration validation and issuer. Additionally, a new configuration property for passport issuer was added. Test cases were extended to include these validation steps.
Gcolon021 and others added 6 commits August 13, 2024 10:17
ToString does no include visas for security purposes.
Updated the logging messages to include additional context by incorporating the authorization code and user subject. These changes were made to allow for chaining logs in splunk.
Reduced the fixed delay for passport validation from 3000000 to 300000 milliseconds to ensure more frequent checks. Added logging to indicate the start of the passport validation process for better traceability.

import java.util.List;

public class Ga4ghPassportV1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a pain, but do we want to name these what they actually stand for and json map them individually? At the very least we should add documentation what they mean

Copy link
Member

@Luke-Sikina Luke-Sikina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't have time to review tests.

@@ -280,6 +283,14 @@ public void setToken(String token) {
this.token = token;
}

public String getPassport() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a passport?

Refactor RoleService to modularize role extraction and validation logic during fence mapping permission creation. Cleaned up the initialization logic in RASPassPortService and improved string handling. Simplified access rule cache eviction and standardized user variable naming across authentication services.
Reversed the condition to correctly handle non-empty authentication responses. Previously, the code incorrectly treated non-empty responses as empty, leading to skipped session initialization.
Changed the token refresh service to return typed `RefreshToken` responses instead of maps. Introduced `ValidRefreshToken` and `InvalidRefreshToken` types. Updated tests and controller to handle the new response types appropriately.
Created a migration script to add a 'passport' column of type TEXT to the 'user' table.
@Gcolon021 Gcolon021 merged commit e726eb3 into release Aug 22, 2024
2 checks passed
@Gcolon021 Gcolon021 deleted the RAS-Passport branch September 18, 2024 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants