Package org.apache.shiro.authc

Examples of org.apache.shiro.authc.AuthenticationException


                String msg = "The credentials provided for account [" + token +
                        "] did not match the expected credentials.";
                throw new IncorrectCredentialsException(msg);
            }
        } else {
            throw new AuthenticationException("A CredentialsMatcher must be configured in order to verify " +
                    "credentials during authentication.  If you do not wish for credentials to be examined, you " +
                    "can configure an " + AllowAllCredentialsMatcher.class.getName() + " instance.");
        }

        return info;
View Full Code Here


    } catch (NullPointerException e) {
      List<ControlParameter> parameters = request.getHandler().getParameters();
      for (ControlParameter parameter : parameters) {
        if (parameter instanceof ContextualParameter) {
          if (AuthenticationException.class.isAssignableFrom(parameter.getType())) {
            request.getContextualArguments().put((ContextualParameter)parameter, new AuthenticationException(e.getCause()));
            return stage.invoke();
          }
        }
      }
View Full Code Here

            try {
                LOGGER.debug("Attempting login for user {}", username);
                identity = this.provider.logonUser(username, new String(token.getPassword()));
                if (identity.isGuest()) {
                    LOGGER.debug("Guest identity for user {}; denying access", username);
                    throw new AuthenticationException("Guest identities are not allowed access");
                }
                final Object principal = new WaffleFqnPrincipal(identity);
                authenticationInfo = buildAuthenticationInfo(token, principal);
                LOGGER.debug("Successful login for user {}", username);
            } catch (RuntimeException e) {
                LOGGER.debug("Failed login for user {}: {}", username, e.getMessage());
                LOGGER.trace("{}", e);
                throw new AuthenticationException("Login failed", e);
            } finally {
                if (identity != null) {
                    identity.dispose();
                }
            }
View Full Code Here

        try {
            securityContext = this.windowsAuthProvider.acceptSecurityToken(token.getConnectionId(), inToken,
                    token.getSecurityPackage());
        } catch (Exception e) {
            LOGGER.warn("error logging in user: {}", e.getMessage());
            throw new AuthenticationException(e);
        }

        final byte[] continueTokenBytes = securityContext.getToken();
        token.setOut(continueTokenBytes);
        if (continueTokenBytes != null) {
View Full Code Here

            Authentication authenticate =
                authenticator.authenticate(token.getPrincipal().toString(), (Credentials) token.getCredentials());
            return new SimpleAuthenticationInfo(authenticate.getUsername(), authenticate.getCredentials(),
                "openengsb");
        } catch (org.openengsb.domain.authentication.AuthenticationException e) {
            throw new AuthenticationException(e);
        }
    }
View Full Code Here

                if (this.authenticationPolicy.isAuthenticationRequired(connection)) {
                    AuthenticationToken token = this.authenticationTokenFactory.getAuthenticationToken(connection);
                    if (token == null) {
                        String msg = "Unable to obtain authentication credentials for newly established connection.  " +
                                "Authentication is required.";
                        throw new AuthenticationException(msg);
                    }
                    //token is not null - login the current subject:
                    subject.login(token);
                }
            }
View Full Code Here

                throw new IncorrectCredentialsException("Authentication Failed. Password for account " + token.getPrincipal() + " was incorrect!", ice.getCause());
            } catch (LockedAccountException lae) {
                throw new LockedAccountException("Authentication Failed. The account for username " + token.getPrincipal() + " is locked."
                        + "Please contact your administrator to unlock it.", lae.getCause());
            } catch (AuthenticationException ae) {
                throw new AuthenticationException("Authentication Failed.", ae.getCause());
            }
        }
    }
View Full Code Here

                throw new IncorrectCredentialsException("Authentication Failed. Password for account " + token.getPrincipal() + " was incorrect!", ice.getCause());
            } catch (LockedAccountException lae) {
                throw new LockedAccountException("Authentication Failed. The account for username " + token.getPrincipal() + " is locked."
                    + "Please contact your administrator to unlock it.", lae.getCause());
            } catch (AuthenticationException ae) {
                throw new AuthenticationException("Authentication Failed.", ae.getCause());
            }
        }
    }
View Full Code Here

  @Override
  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
    UsernamePasswordToken upToken = (UsernamePasswordToken) token;
    User user = permission.getUserByUsername(upToken.getUsername());
    if (user == null) {
      throw new AuthenticationException();
    }
    return new SimpleAuthenticationInfo(user, user.getPassword(), getName());
  }
View Full Code Here

            final String message = "There was a SQL error while authenticating user [" + username + "]";
            if (log.isErrorEnabled()) {
                log.error(message, e);
            }

            throw new AuthenticationException(message, e);
        } finally {
            JdbcUtils.closeConnection(conn);
        }

        return info;
View Full Code Here

TOP

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

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.