A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Code Examples of UsernamePasswordAuthenticationToken


            username = pair[0];
            password = pair[1];

            if (authenticationIsRequired(username)) {
                UsernamePasswordAuthenticationToken authRequest =
                        new UsernamePasswordAuthenticationToken(username, password);
                authRequest.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request));

                Authentication authResult;

                try {
                    authResult = authenticationManager.authenticate(authRequest);

View Full Code Here


           i++){
             ga[i] = new GrantedAuthorityImpl((String)iter.next());
           }

	  UsernamePasswordAuthenticationToken upat =
		  new UsernamePasswordAuthenticationToken(
				  new User(auth.getName(),
					  (auth.getCredentials() == null ? null : auth.getCredentials().toString()),
					  true,
					  true,
					  true,

View Full Code Here


        if (roles != null && roles.length > 0) {
            List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(roles.length);
            for (int i = 0; i < roles.length; i++) {
                authorities.add(new GrantedAuthorityImpl(roles[i]));
            }
            authToken = new UsernamePasswordAuthenticationToken(username, password, authorities);
        } else {
            authToken = new UsernamePasswordAuthenticationToken(username, password);
        }
        return authToken;
    }

    private void sendMessageWithAuthentication(String username, String password, String... roles) {

View Full Code Here


    protected Authentication convertToAuthentication(Subject subject) {
        Authentication answer = null;
        for (Principal principal : subject.getPrincipals()) {
            if (principal instanceof WSUsernameTokenPrincipal) {
                WSUsernameTokenPrincipal ut = (WSUsernameTokenPrincipal) principal;
                answer = new UsernamePasswordAuthenticationToken(ut.getName(), ut.getPassword());
                break;
            }
        }
        return answer;
    }

View Full Code Here


   * @param username  the username used for logging in via XML-RPC
   * @param password  the password used for logging in via XML-RPC
   */
  protected void authenticate(Blog blog, String username, String password) throws XmlRpcAuthenticationException {
    try {
      Authentication auth = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password));
      SecurityContextHolder.getContext().setAuthentication(auth);

      if (blog != null && !SecurityUtils.isUserAuthorisedForBlogAsBlogContributor(blog)) {
        throw new XmlRpcAuthenticationException("Not authorised for this blog.");
      }

View Full Code Here


    /**
     * {@inheritDoc}
     */
    public Authentication getAuthentication(org.mule.api.security.Authentication authentication)
    {
        return new UsernamePasswordAuthenticationToken(authentication.getPrincipal(),
            authentication.getCredentials());
    }
}


View Full Code Here

TOP

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

TOP