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

Refactor Login Page Creation in initiateAuthenticationRequest Method #177

Merged

Conversation

dhaura
Copy link
Contributor

@dhaura dhaura commented Apr 5, 2024

Purpose

  • Extract login page creation in initiateAuthenticationRequest() method into protected method.

Related Issues

String loginPage = prepareLoginPage(request, context);
response.sendRedirect(loginPage);
if (LoggerUtils.isDiagnosticLogsEnabled()) {
DiagnosticLog.DiagnosticLogBuilder diagnosticLogBuilder = new DiagnosticLog.DiagnosticLogBuilder(
Copy link

Choose a reason for hiding this comment

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

Why do we need build the diagnostic builder when refactoring?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is initially created in the refactored method, prepareLoginPage(). Since we are using diagnostic logs outside of the refactored method, we need to create it again.

As an alternative, we can create the diagnosticLogBuilder at the top of the initiateAuthenticationRequest() method and pass it as a param to prepareLoginPage() (only if diagnostic logs are enabled, otherwise a null value will be passed).

Copy link
Contributor Author

@dhaura dhaura Apr 5, 2024

Choose a reason for hiding this comment

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

Addressed with 784af7d and 8598f8b.

* @return Extracted scopes as a String.
*/
protected String extractScopesFromURL(String url) throws UnsupportedEncodingException {

Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we extract the query params first from URL and them execute the next logic on top of that?

If the scope is the first query param (<URL>?scope=a b c&...), I think the following logic does not recognize the scopes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed with 1bfe9d9

@jenkins-is-staging
Copy link

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/8579215697

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/8579215697
Status: success

Copy link

@jenkins-is-staging jenkins-is-staging left a comment

Choose a reason for hiding this comment

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

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/8579215697

@AnuradhaSK AnuradhaSK merged commit 2bc1ab2 into wso2-extensions:master Apr 6, 2024
3 checks passed
@dhaura dhaura mentioned this pull request Apr 9, 2024
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.

4 participants