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

Commit

Permalink
Fix problem with kerberos login: https://bugzilla.redhat.com/show_bug…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Dec 18, 2012
1 parent d3573bc commit e250f3b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 0 additions & 2 deletions zanata-war/src/main/java/org/zanata/action/ProfileAction.java
Expand Up @@ -139,8 +139,6 @@ public void onCreate()
email = identity.getCredentials().getUsername() + "@" + domain;
}
}

identity.unAuthenticate();
}
else
{
Expand Down
Expand Up @@ -160,7 +160,7 @@ public void kerberosLogin()
{
SpNegoIdentity spNegoIdentity = (SpNegoIdentity) Component.getInstance(SpNegoIdentity.class, ScopeType.SESSION);
spNegoIdentity.authenticate();
if (!isAuthenticatedAccountWaitingForActivation())
if (!isNewUser() && !isAuthenticatedAccountWaitingForActivation())
{
spNegoIdentity.login();
}
Expand Down Expand Up @@ -239,13 +239,13 @@ public String getAuthenticationRedirect()
{
return "inactive";
}
else if(identity.isPreAuthenticated() && isNewUser())
{
return "edit";
}
else if (identity.isLoggedIn())
{
if (isNewUser())
{
return "edit";
}
else if (userRedirect != null && userRedirect.isRedirect())
if (userRedirect != null && userRedirect.isRedirect())
{
return "redirect";
}
Expand Down Expand Up @@ -300,10 +300,10 @@ public void onLoginCompleted(AuthenticationType authType)
}
}

public boolean isAccountActivated(String username)
public boolean isAccountWaitingForActivation(String username)
{
HAccount account = accountDAO.getByUsername(username);
if (account != null && account.getAccountActivationKey() == null)
if (account != null && account.getAccountActivationKey() != null)
{
return true;
}
Expand Down Expand Up @@ -331,7 +331,7 @@ public boolean isAuthenticatedAccountWaitingForActivation()
userIsAuthenticated = identityStore.authenticateEvenIfDisabled(credentials.getUsername(), credentials.getPassword());
}

return userIsAuthenticated && !isAccountEnabled(credentials.getUsername()) && !isAccountActivated(credentials.getUsername());
return userIsAuthenticated && !isAccountEnabled(credentials.getUsername()) && isAccountWaitingForActivation(credentials.getUsername());
}

public boolean isNewUser(String username)
Expand Down Expand Up @@ -378,7 +378,7 @@ private boolean isAccountEnabledAndActivated()
else
{
String message = "";
if (!isAccountActivated(username))
if (isAccountWaitingForActivation(username))
{
message = "#{messages['org.jboss.seam.loginFailed']}";
}
Expand Down
Expand Up @@ -70,6 +70,7 @@ public void authenticate()
identity.getCredentials().setPassword("");
identity.getCredentials().setAuthType(AuthenticationType.KERBEROS);
identity.getCredentials().setInitialized(true);
identity.setPreAuthenticated(true);
}

public void login()
Expand Down

0 comments on commit e250f3b

Please sign in to comment.