Package org.springframework.security.authentication

Examples of org.springframework.security.authentication.AuthenticationServiceException


  public static final String SQLXDAMS_SECURITY_FORM_COMPANY_KEY = "j_company";
  private String companyParameter = SQLXDAMS_SECURITY_FORM_COMPANY_KEY;
  @Override
  public Authentication attemptAuthentication(HttpServletRequest arg0,HttpServletResponse arg1) throws AuthenticationException {
    if (!arg0.getMethod().equals("POST")) {
      throw new AuthenticationServiceException("Authentication method not supported: " + arg0.getMethod());
    }
    String username = obtainUsername(arg0);
    String password = obtainPassword(arg0);
    String company  = obtainCompany(arg0);
    if (username == null) {
View Full Code Here


    String username = arg0.getHeader(SSO_userParam);
    String errorMsg = "";
    System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><username = " + username);
    if (username == null) {
      errorMsg = "A Utente disconnesso. <a href=\"javascript:self.close()\">[CHIUDERE]</a> la finestra per tornare al Portale.";
      throw new AuthenticationServiceException(errorMsg);
    }
    System.out.println("AuthenticationSSOFilter.attemptAuthentication() 1");
    username = username.trim();
    String key = arg0.getParameter("key");
    System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><key = " + key);
    if (key == null) {
      errorMsg = "B Utente disconnesso. <a href=\"javascript:self.close()\">[CHIUDERE]</a> la finestra per tornare al Portale.";
      throw new AuthenticationServiceException(errorMsg);
    }
    System.out.println("AuthenticationSSOFilter.attemptAuthentication() 2");
    String verificaUrl;
    try {
      verificaUrl = StringsUtils.postForString(new URL(SSO_verificaToken_URL), "key=" + key + "&" + SSO_verificaToken_URL_params);
      if (verificaUrl.indexOf("KO") != -1) {
        errorMsg = "Si è verificato un errore nella verifica dell'utente (keytest)";
        throw new AuthenticationServiceException(errorMsg);
      }
      arg0.getSession().setAttribute("alfresco_token", key);
      System.out.println("keykeykeykeykeykeykeykeykeykey "+key);
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    System.out.println("AuthenticationSSOFilter.attemptAuthentication() 3");
    try {
      String regSessUrl = StringsUtils.postForString(new URL(SSO_regSession_URL), "key=" + key + "&SESSIONAPL=" + URLEncoder.encode("JSESSIONID=", "utf-8") + arg0.getSession().getId() + "&" + SSO_regSession_URL_params);
      if (regSessUrl.indexOf("KO") != -1) {
        errorMsg = "Si è verificato un errore nella verifica dell'utente (regsess)";
        throw new AuthenticationServiceException(errorMsg);
      }
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
View Full Code Here

                    return;
                }

                if (user == null) {
                    throw new AuthenticationServiceException(
                            "AuthenticationDao returned null, which is an interface contract violation");
                }

                userCache.putUserInCache(user);
            }
View Full Code Here

                return createSuccessfulAuthentication(userDetails, response);

            } else if (status == OpenIDAuthenticationStatus.CANCELLED) {
                throw new AuthenticationCancelledException("Log in cancelled");
            } else if (status == OpenIDAuthenticationStatus.ERROR) {
                throw new AuthenticationServiceException("Error message from server: " + response.getMessage());
            } else if (status == OpenIDAuthenticationStatus.FAILURE) {
                throw new BadCredentialsException("Log in failed - identity could not be verified");
            } else if (status == OpenIDAuthenticationStatus.SETUP_NEEDED) {
                throw new AuthenticationServiceException(
                        "The server responded setup was needed, which shouldn't happen");
            } else {
                throw new AuthenticationServiceException("Unrecognized return value " + status.toString());
            }
        }

        return null;
    }
View Full Code Here

    //~ Methods ========================================================================================================

    public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
        if (postOnly && !request.getMethod().equals("POST")) {
            throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod());
        }

        String username = obtainUsername(request);
        String password = obtainPassword(request);
View Full Code Here

                // Indicate to parent class that authentication is continuing.
                return null;
            } catch (OpenIDConsumerException e) {
                logger.debug("Failed to consume claimedIdentity: " + claimedIdentity, e);
                throw new AuthenticationServiceException("Unable to process claimed identity '" + claimedIdentity + "'");
            }
        }

        if (logger.isDebugEnabled()) {
            logger.debug("Supplied OpenID identity is " + identity);
        }

        try {
            token = consumer.endConsumption(request);
        } catch (OpenIDConsumerException oice) {
            throw new AuthenticationServiceException("Consumer error", oice);
        }

        token.setDetails(authenticationDetailsSource.buildDetails(request));

        // delegate to the authentication provider
View Full Code Here

                        "LdapAuthenticationProvider.badCredentials", "Bad credentials"));
            } else {
                throw notFound;
            }
        } catch (NamingException ldapAccessFailure) {
            throw new AuthenticationServiceException(ldapAccessFailure.getMessage(), ldapAccessFailure);
        }
    }
View Full Code Here

        Method saltMethod = findSaltMethod(user);

        try {
            return saltMethod.invoke(user, new Object[] {});
        } catch (Exception exception) {
            throw new AuthenticationServiceException(exception.getMessage(), exception);
        }
    }
View Full Code Here

            if (pd != null) {
                saltMethod = pd.getReadMethod();
            }

            if (saltMethod == null) {
                throw new AuthenticationServiceException("Unable to find salt method on user Object. Does the class '" +
                    user.getClass().getName() + "' have a method or getter named '" + userPropertyToUse + "' ?");
            }
        }

        return saltMethod;
View Full Code Here

        try {
            loadedUser = this.getUserDetailsService().loadUserByUsername(username);
        }
        catch (DataAccessException repositoryProblem) {
            throw new AuthenticationServiceException(repositoryProblem.getMessage(), repositoryProblem);
        }

        if (loadedUser == null) {
            throw new AuthenticationServiceException(
                    "UserDetailsService returned null, which is an interface contract violation");
        }
        return loadedUser;
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.authentication.AuthenticationServiceException

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.