Created
March 24, 2011 05:09
-
-
Save bleathem/884607 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.jboss.seam.security.examples.simple; | |
import javax.inject.Inject; | |
import org.jboss.seam.security.Authenticator; | |
import org.jboss.seam.security.BaseAuthenticator; | |
import org.jboss.seam.security.Credentials; | |
import org.picketlink.idm.impl.api.PasswordCredential; | |
import org.picketlink.idm.impl.api.model.SimpleUser; | |
/** | |
* This is the simplest possible example of a custom authenticator. | |
* | |
* @author Shane Bryzak | |
* | |
*/ | |
public class SimpleAuthenticator extends BaseAuthenticator implements Authenticator | |
{ | |
@Inject Credentials credentials; | |
@Override | |
public void authenticate() | |
{ | |
if ("demo".equals(credentials.getUsername()) && | |
credentials.getCredential() instanceof PasswordCredential && | |
"demo".equals(((PasswordCredential) credentials.getCredential()).getValue())) | |
{ | |
setStatus(AuthenticationStatus.SUCCESS); | |
setUser(new SimpleUser("demo")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment