Examples of UsernamePasswordAuthentication


Examples of org.apache.ftpserver.usermanager.UsernamePasswordAuthentication

     * User authenticate method
     */
    public User authenticate(Authentication authentication)
            throws AuthenticationFailedException {
        if (authentication instanceof UsernamePasswordAuthentication) {
            UsernamePasswordAuthentication upauth = (UsernamePasswordAuthentication) authentication;

            String user = upauth.getUsername();
            String password = upauth.getPassword();

            if (user == null) {
                throw new AuthenticationFailedException("Authentication failed");
            }

View Full Code Here

Examples of org.apache.ftpserver.usermanager.UsernamePasswordAuthentication

     * User authentication.
     */
    public User authenticate(Authentication authentication)
            throws AuthenticationFailedException {
        if (authentication instanceof UsernamePasswordAuthentication) {
            UsernamePasswordAuthentication upauth = (UsernamePasswordAuthentication) authentication;

            String user = upauth.getUsername();
            String password = upauth.getPassword();

            if (user == null) {
                throw new AuthenticationFailedException("Authentication failed");
            }

View Full Code Here

Examples of org.beangle.security.auth.UsernamePasswordAuthentication

    String username = get("username");
    String password = get("password");
    if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) { return "failure"; }
    username = username.trim();
    HttpServletRequest request = getRequest();
    UsernamePasswordAuthentication auth = new UsernamePasswordAuthentication(username, password);
    auth.setDetails(authenticationDetailsSource.buildDetails(request));
    Authentication authRequest = auth;
    try {
      authRequest = authenticationManager.authenticate(authRequest);
      sessionRegistry.register(authRequest, request.getSession().getId());
      SecurityContextHolder.getContext().setAuthentication(authRequest);
View Full Code Here

Examples of org.beangle.security.auth.UsernamePasswordAuthentication

  private CasAuthentication authenticateNow(CasAuthentication auth) throws AuthenticationException {
    try {
      final Assertion assertion = ticketValidator.validate(auth.getCredentials().toString(),
          auth.getLoginUrl());
      String name = assertion.getPrincipal().getName();
      final UserDetail userDetail = userDetailService.loadDetail(new UsernamePasswordAuthentication(
          name, null));
      if (null == userDetail) {
        logger.error("cannot load {}'s detail from system", name);
        throw new UsernameNotFoundException(StrUtils.concat("user ", name, " not found in system"));
      }
View Full Code Here

Examples of org.beangle.security.auth.UsernamePasswordAuthentication

      password = "";
    }

    username = username.trim();

    UsernamePasswordAuthentication authRequest = new UsernamePasswordAuthentication(username, password);

    // Place the last username attempted into HttpSession for views
    HttpSession session = request.getSession(false);

    if (session != null || getAllowSessionCreation()) {
View Full Code Here

Examples of org.beangle.security.auth.UsernamePasswordAuthentication

    return createSuccessAuthentication(principalToReturn, authentication, user);
  }

  protected Authentication createSuccessAuthentication(Object principal, Authentication authentication,
      UserDetail user) {
    UsernamePasswordAuthentication result = new UsernamePasswordAuthentication(principal,
        authentication.getCredentials(), user.getAuthorities());
    result.setDetails(authentication.getDetails());
    return result;
  }
View Full Code Here

Examples of org.beangle.security.auth.UsernamePasswordAuthentication

    return createSuccessAuthentication(principalToReturn, authentication, user);
  }

  protected Authentication createSuccessAuthentication(Object principal,
      Authentication authentication, UserDetail user) {
    UsernamePasswordAuthentication result = new UsernamePasswordAuthentication(principal,
        authentication.getCredentials(), user.getAuthorities());
    result.setDetails(authentication.getDetails());
    return result;
  }
View Full Code Here

Examples of org.beangle.security.auth.UsernamePasswordAuthentication

  protected String doLogin() {
    String username = get("username");
    String password = get("password");
    if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) { return "failure"; }
    username = username.trim();
    UsernamePasswordAuthentication auth= new UsernamePasswordAuthentication(username,
        password);
    auth.setDetails(authenticationDetailsSource.buildDetails(request));
    Authentication authRequest =auth;
    try {
      authRequest= authenticationManager.authenticate(authRequest);
      sessionStrategy.onAuthentication(authRequest, request, null);
      SecurityContextHolder.getContext().setAuthentication(authRequest);
View Full Code Here

Examples of org.beangle.security.auth.UsernamePasswordAuthentication

  private CasAuthentication authenticateNow(CasAuthentication auth) throws AuthenticationException {
    try {
      final Assertion assertion = ticketValidator.validate(auth.getCredentials().toString(),
          auth.getLoginUrl());
      String name = assertion.getPrincipal();
      final UserDetail userDetail = userDetailService.loadDetail(new UsernamePasswordAuthentication(
          name, null));
      if (null == userDetail) {
        logger.error("cannot load {}'s detail from system", name);
        throw new UsernameNotFoundException(StrUtils.concat("user ", name, " not found in system"));
      }
View Full Code Here

Examples of org.beangle.security.auth.UsernamePasswordAuthentication

    String username = get("username");
    String password = get("password");
    if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) { return "failure"; }
    username = username.trim();
    HttpServletRequest request = getRequest();
    UsernamePasswordAuthentication auth = new UsernamePasswordAuthentication(username, password);
    auth.setDetails(authenticationDetailsSource.buildDetails(request));
    Authentication authRequest = auth;
    try {
      authRequest = authenticationManager.authenticate(authRequest);
      sessionRegistry.register(authRequest, request.getSession().getId());
      SecurityContextHolder.getContext().setAuthentication(authRequest);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.