Package org.acegisecurity

Examples of org.acegisecurity.Authentication


                                 * ============================================
                                 * Attempt CAS authentication
                                 * ============================================
                                 */
                                logger.debug("checking if context contains CAS authentication");
                                Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
                                if (authentication != null && authentication.isAuthenticated()) {
                                    logger.debug("security context contains CAS authentication, initializing session");
                                    JtracSession.get().setUser((User) authentication.getPrincipal());
                                    return true;
                                }
                            }
                           
                            /*
 
View Full Code Here


    public User authenticate(String loginName, String password) {
        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(
                loginName, password);
        AuthenticationManager am = (AuthenticationManager) applicationContext.getBean("authenticationManager");
        try {
            Authentication authentication = am.authenticate(token);
            return (User) authentication.getPrincipal();
        } catch (AuthenticationException ae) {
            logger.debug("acegi authentication failed: " + ae);
            return null;
        }
    }
View Full Code Here

    return true;
  }

  public Set<String> getPrincipalAuthorities() {
    Set<String> result = new HashSet<String>();
    Authentication auth = SecurityContextHolder.getContext()
        .getAuthentication();
    if (auth != null) {
      GrantedAuthority[] authorities = auth.getAuthorities();
      if (authorities != null) {
        for (GrantedAuthority authority : authorities) {
          result.add(authority.getAuthority());
        }
        return result;
View Full Code Here

      session = request.getSession(false);
    } catch (IllegalStateException ignored) {
    }
    if (session != null
        && (replace || session.getAttribute(Constants.LOGIN_USER) == null)) {
      Authentication auth = SecurityContextHolder.getContext()
          .getAuthentication();
      if (auth != null) {
        Object principal = auth.getPrincipal();
        if (principal instanceof UserDetails) {
          Object user = userManager
              .getUserByName(((UserDetails) principal)
                  .getUsername());
          session.setAttribute(Constants.LOGIN_USER, user);
View Full Code Here

          if (contextFromSessionObject instanceof SecurityContext) {

            SecurityContext securityContext = (SecurityContext) contextFromSessionObject;
            if (Constants.isRelogin()) {

              Authentication auth = securityContext
                  .getAuthentication();
              if (auth != null) {
                Object principal = auth.getPrincipal();
                if (principal instanceof UserDetails) {
                  UserDetails ud1 = (UserDetails) principal;
                  UserDetails ud2 = userCache
                      .getUserFromCache(ud1.getUsername());
                  if (!equalsForUser(ud1, ud2)) {
View Full Code Here

        saveMessage(request, getText("user.registered", user.getUsername(), locale));
        request.getSession().setAttribute(Constants.REGISTERED, Boolean.TRUE);

        // log user in automatically
        Authentication auth = new UsernamePasswordAuthenticationToken(user.getUsername(), user.getConfirmPassword());
        try {
            ApplicationContext ctx =
                    WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
            if (ctx != null) {
                ProviderManager authenticationManager = (ProviderManager) ctx.getBean("authenticationManager");
View Full Code Here

    /**
     * Requires the admin access to be able to push
     */
    @Override
    public ReceivePack createReceivePack(HttpServletRequest context, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException {
        Authentication a = Jenkins.getAuthentication();
        ReceivePack rp = createReceivePack(db);
        rp.setRefLogIdent(new PersonIdent(a.getName(),a.getName()+"@"+context.getRemoteAddr()));
        return rp;
    }
View Full Code Here

                String cmd = args[0];
               
                try {
                  BotCommand command = this.cmdsAndAliases.get(cmd);
                    if (command != null) {
                      Authentication oldAuthentication = SecurityContextHolder.getContext().getAuthentication();
                      try {
                          if (this.authentication != null) {
                              SecurityContextHolder.getContext().setAuthentication(this.authentication.getAuthentication());
                          }
                        command.executeCommand(this, this.chat, msg, s, args);
View Full Code Here

                    new Object[]{uuid, revision, paths});
            boolean notified = false;
            // run in high privilege to see all the projects anonymous users don't see.
            // this is safe because when we actually schedule a build, it's a build that can
            // happen at some random time anyway.
            Authentication old = SecurityContextHolder.getContext().getAuthentication();
            SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM);
            try {
                for (SCMSourceOwner owner : SCMSourceOwners.all()) {
                    for (SCMSource source : owner.getSCMSources()) {
                        if (source instanceof SubversionSCMSource) {
View Full Code Here

            return "Execute system Groovy script";
        }

        @Override
        public boolean isApplicable(Class<? extends AbstractProject> jobType) {
            Authentication a = Hudson.getAuthentication();
            if (Hudson.getInstance().getACL().hasPermission(a, Jenkins.RUN_SCRIPTS)) {
                return true;
            }
            return false;
        }
View Full Code Here

TOP

Related Classes of org.acegisecurity.Authentication

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.