Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Fix redirect to login page when using single open id provider authentication #579

Closed
wants to merge 3 commits into from

Conversation

carlosmunoz
Copy link
Member

This pull request ensures that when accessing a link directly (e.g. going to the editor from a bookmarked link) under single open id provider authentication, Zanata will not go to the usual login page, but instead will go directly to the provider.

Things to test:

  • Login button works for internal and open id configurations (both single and multiple provider)
  • Accessing an unauthenticated protected url on internal auth should redirect to the login page.
  • Accessing an unauthenticated protected url on single provider open id auth should redirect to the provider's page.

/**
*
*/
public String goToLoginPage() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method does not actually go to a page, right? It just returns a string representing the page to go to. Could it be named something like getLoginPageId or getLoginPagePath?

Copy link
Contributor

Choose a reason for hiding this comment

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

This could use a non-empty doc comment, particularly if it keeps the strange name.

Copy link
Member Author

Choose a reason for hiding this comment

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

This method is executed as soon as someone enters the login page. So, if they are already logged in, they are redirected to the dashboard, if there's only a single open id provider then they are redirected to the provider, otherwise, they are shown the usual login page.

Maybe something like onLoginPageAccessed

@davidmason
Copy link
Contributor

Code structure looks fine. Could use some documentation or a name change where indicated. Names that work well in the xml seem inappropriate in Java, so it is probably futile looking for ideal names.

@djansen-redhat
Copy link
Contributor

✅ Tested.

* This method is executed when accessing the login page. Depending on
* current session state, it might indicate to redirect to a different
* location. For example, if the user is already logged in, it will indicate
* to redirect to the dashboard.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the first line should give a reasonable summary, before giving all the details. e.g.

/**
 * Indicates which page the user should be directed to when trying to log in.
 * ...

@carlosmunoz
Copy link
Member Author

@davidmason Made the changes you indicated. Can you please take another look before I send it for QA?

@davidmason
Copy link
Contributor

👍 Passed review.

@carlosmunoz
Copy link
Member Author

@djansen-redhat Could you please give this another QA pass? Just to make sure nothing has been borken after code review changes.

@djansen-redhat
Copy link
Contributor

@carlosmunoz on it

@djansen-redhat
Copy link
Contributor

✅ Retested.

carlosmunoz pushed a commit that referenced this pull request Sep 5, 2014
…ication

Pull request #579

Squashed commit of the following:

commit a9ba559
Author: Carlos A. Munoz <camunoz@redhat.com>
Date:   Thu Sep 4 16:56:35 2014 +1000

    Rename methods and change comments.

commit 48da2ea
Author: Carlos A. Munoz <camunoz@redhat.com>
Date:   Thu Sep 4 15:03:47 2014 +1000

    Code review updates.

commit 8a3d899
Author: Carlos A. Munoz <camunoz@redhat.com>
Date:   Thu Sep 4 12:04:30 2014 +1000

    Fix redirect to login page when using single open id provider authentication.
@carlosmunoz
Copy link
Member Author

Merged in commit 48d12c3

@carlosmunoz carlosmunoz closed this Sep 5, 2014
@carlosmunoz carlosmunoz deleted the login-redirect-fix branch September 5, 2014 01:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
3 participants