Package org.apache.shiro.authc

Examples of org.apache.shiro.authc.AuthenticationToken


    }

    @Override
    public SecurityContext create(String userName, String credential, boolean isSecure, String authcScheme, String host) {

        AuthenticationToken authToken;
        if (credential == null) {
            authToken = new UsernamePasswordToken(userName, credential, host);
        } else {
            if (credential.equalsIgnoreCase("session")) {
                authToken = new SessionIdToken(userName, host);
View Full Code Here


    public String resolveHost() {
        String host = getHost();

        if (host == null) {
            //check to see if there is an AuthenticationToken from which to retrieve it:
            AuthenticationToken token = getAuthenticationToken();
            if (token instanceof HostAuthenticationToken) {
                host = ((HostAuthenticationToken) token).getHost();
            }
        }
View Full Code Here

  private static transient final Logger log = LoggerFactory.getLogger(MySecurityManager.class);

  public static boolean login(String username, String password) {
    boolean isLogin = false;
    try {
      AuthenticationToken token = new UsernamePasswordToken(username, password);
      Subject currentUser = SecurityUtils.getSubject();
      currentUser.login(token);
      isLogin = true;
    } catch (AuthenticationException e) {
      log.error("login fail!,case as ", e);
View Full Code Here

    public AuthenticationSession authenticate(final AuthenticationRequest request, final String code) {
        RealmSecurityManager securityManager = getSecurityManager();
        if(securityManager == null) {
            return null;
        }
        final AuthenticationToken token = asAuthenticationToken(request);
       
        Subject currentUser = SecurityUtils.getSubject();
        if(currentUser.isAuthenticated()) {
            // TODO: verify the code passed in that this session is still alive?
           
View Full Code Here

        HttpServletResponse response = createMock(HttpServletResponse.class);
       
        replay(request);
        replay(response);
       
    AuthenticationToken token = testFilter.createToken(request, response);
    assertNotNull(token);
    assertTrue("Token is not a username and password token.", token instanceof UsernamePasswordToken);
    assertEquals("", token.getPrincipal());
   
    verify(request);
    verify(response);
    }
View Full Code Here

        HttpServletResponse response = createMock(HttpServletResponse.class);
       
        replay(request);
        replay(response);
       
    AuthenticationToken token = testFilter.createToken(request, response);
    assertNotNull(token);
    assertTrue("Token is not a username and password token.", token instanceof UsernamePasswordToken);
    assertEquals("", token.getPrincipal());
   
    verify(request);
    verify(response);
    }
View Full Code Here

        HttpServletResponse response = createMock(HttpServletResponse.class);
       
        replay(request);
        replay(response);
       
    AuthenticationToken token = testFilter.createToken(request, response);
    assertNotNull(token);
    assertTrue("Token is not a username and password token.", token instanceof UsernamePasswordToken);
   
    UsernamePasswordToken upToken = (UsernamePasswordToken) token;
    assertEquals("pedro", upToken.getUsername());
View Full Code Here

        jdbcRealm = new JdbcRealm();
    }

    @Override
    public boolean authenticate(String userName, Object credentials) throws UserStoreException {
        AuthenticationToken authenticationToken = new UsernamePasswordToken(userName,
                passwordDigester.getPasswordHashValue((String) credentials));

        AuthenticationInfo authenticationInfo;
        try {
View Full Code Here

    private PasswordDigester passwordDigester;

    public boolean authenticate(String userName, Object credentials) throws UserStoreException {

        AuthenticationToken authenticationToken = new UsernamePasswordToken(userName,
                passwordDigester.getPasswordHashValue((String) credentials));

        AuthenticationInfo authenticationInfo;
        try {
            authenticationInfo = ldapRealm.getAuthenticationInfo(authenticationToken);
View Full Code Here

    public String resolveHost() {
        String host = getHost();

        if (host == null) {
            //check to see if there is an AuthenticationToken from which to retrieve it:
            AuthenticationToken token = getAuthenticationToken();
            if (token instanceof HostAuthenticationToken) {
                host = ((HostAuthenticationToken) token).getHost();
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.shiro.authc.AuthenticationToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.