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

[ALS-5514] AIM-AHEAD PIC-SURE AuthN #148

Closed
wants to merge 47 commits into from
Closed

Conversation

Gcolon021
Copy link
Contributor

No description provided.

JamesPeck and others added 28 commits December 14, 2023 13:59
OktaAuthenticationService has been added to handle interactions with Okta's SDK for user authentication. Session status is fetched and checked to verify if a user is authenticated. The necessary Okta SDK dependency is also included in the pic-sure-auth-services module.
This update modifies the HTTP method for the authenticate method in OktaAuthenticationService from POST to GET. This change aligns with our data retrieval patterns, and adapts it to receive parameters from the URL instead of the request body. The import statement also refactored to use wildcard import for javax.ws.rs package.
The commit updates the version of the Okta SDK used in the project to 1.4.0 and introduces a new dependency, okta-sdk-impl. The new dependency and version number are now managed through a property, improving consistency and making version management easier.
This commit adjusts the Okta authentication process to use JNDI lookups instead of environment variables, improving the security and flexibility of the authentication process in `OktaAuthenticationService`. It also includes aesthetic code changes for better readability, like correcting indentation, removing unnecessary imports and refining logger messages for the user.
The error logging code for the Okta provider check has been updated to include the exception message before displaying its custom error. This will facilitate troubleshooting by providing the actual error message alongside potential configuration fixes. Code readability has also been enhanced with minor formatting adjustments.
This commit updates the version of the maven-war-plugin to 3.2.2 in the pom.xml file for the project pic-sure-auth-services. This change is necessary for compatibility with newer versions of Apache Maven.
The Okta authentication service has been restructured. The previous OktaAuthenticationService.java file has been deleted and replaced with a new OktaAuthenticationController.java and a OktaOAuthAuthenticationService.java file. The JAXRSConfiguration.java file also has been updated to reflect the changes in the authentication process with the focus on OAuth authentication rather than sessions.
Added Okta Identity Provider (IDP) setup in JAXRSConfiguration.java, enabling SAML error messages to be logged correctly when fields are missing. Also, irrelevant Okta client secret
A new variable `spClientSecret` is introduced in JAXRSConfiguration.java replacing `clientSecret` for Okta Identity Provider setup. The update also changes the way the fence auth header is formed in OktaOAuthAuthenticationService.java, where the new `spClientSecret` is now used. Efficient error logging is ensured for Okta IDP.
The logging in the OktaAuthenticationController has been updated to more comprehensively record login attempts. It no longer logs just the "code" from the authentication request but builds a loop to log each key-value pair within the request for a detailed tracking.
HashMap data structures in the OktaAuthenticationController and OktaOAuthAuthenticationService have been replaced with more generic Map structures. This improves flexibility and maintainability as it's not restrictively tied to the HashMap implementation.
The URLs used for Okta introspect and token requests have been corrected. Previously they erroneously included "/user", which has now been removed to conform with the standard protocol. The token URL has also been amended to include the "https://" protocol, ensuring proper connection handling.
Removed excess log lines in OktaAuthenticationController and added more specific logging in OktaOAuthAuthenticationService. This refines the logging process by reducing verbosity and improving the clarity of the authentication tracking.
Additionally, add logging for redirectURL debugging
@Gcolon021 Gcolon021 changed the base branch from fence-integration-release/0005 to fence-integration January 22, 2024 19:13
Additional logging has been inserted into the OktaOAuthAuthenticationService class. The log records token introspection response and a new check is also implemented to ensure user activity, logging failure if the user is not active.
Gcolon021 and others added 18 commits January 22, 2024 16:08
The Okta introspect endpoint URL in the OktaOAuthAuthenticationService class has been modified. The path "/oauth2/v1/introspect" has been replaced with "/oauth2/default/v1/introspect" to correct the route for token introspection.
Added a new parameter for content type in the doOktaRequest method of the OktaOAuthAuthenticationService class. This allows setting different content types when making requests to Okta API endpoints, improving flexibility and code reuse.
Changes made to the authentication method to rely on the 'access_token'. Previously, the code used our ability to introspect this token; however, the updated format now utilizes the inherent data in "access_token" to properly register PIC-SURE user in the application.
…uthenticationService. The changes wrap the introspectToken method call in a try/catch block to handle potential IOExceptions and interrupted exceptions. In case of any exceptions, appropriate error messages are logged and returned. The initialization of the user is also moved inside a conditional check to keep it only valid if the introspectResponse exists.
The introspectToken method in OktaOAuthAuthenticationService has been optimized to improve error handling. The HttpClient implementation previously used was replaced by a new method, 'doOktaRequest', to simplify the process. Error messages have been updated for better interpretation in case of exceptions. Code responsible for user initialization has been moved to ensure it only occurs if valid introspectResponse exists.
Refactored the introspectToken method in the OktaOAuthAuthenticationService to improve error handling process. Removed the try-catch block for checking token and replaced with a simpler implementation. User initialization now only occurs if a valid introspectResponse is present. This leads to cleaner, more readable code and better exception interpretation.
This commit updates the Okta API documentation link in the introspectToken method's comments. It also removes the redundant contentType parameter in the doOktaRequest function calls, favoring a standard content type of "application/x-www-form-urlencoded" for all of these methods. These changes simplify and streamline the functions while updating reference information.
The commit updates the Okta token URL in OktaOAuthAuthenticationService.java file. The newer URL now points to the 'default' endpoint instead of 'v1' endpoint in the okta oauth2 services.
# Conflicts:
#	pic-sure-auth-services/pom.xml
#	pic-sure-auth-services/src/main/java/edu/harvard/hms/dbmi/avillach/auth/JAXRSConfiguration.java
Load the user by the email and connection. If the user is found, but does not have a subject we should set it using the introspection token claims.
@Gcolon021 Gcolon021 closed this Jan 25, 2024
@Gcolon021 Gcolon021 deleted the ALS-5514 branch January 25, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants