private UserDetails doAuthenticate(String username, String password) throws AuthenticationException { try { UserDetails user = authenticate(username, password); SecurityListener.fireAuthenticated(user); return user; } catch (AuthenticationException x) { SecurityListener.fireFailedToAuthenticate(username); throw x; } }
@Override public SecurityComponents createSecurityComponents() { Binding binding = new Binding(); binding.setVariable("authenticator", new Authenticator()); BeanBuilder builder = new BeanBuilder(); builder.parse(Jenkins.getInstance().servletContext.getResourceAsStream("/WEB-INF/security/AbstractPasswordBasedSecurityRealm.groovy"),binding); WebApplicationContext context = builder.createApplicationContext(); return new SecurityComponents( findBean(AuthenticationManager.class, context), new ImpersonatingUserDetailsService(this)); }
protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException { return AbstractPasswordBasedSecurityRealm.this.doAuthenticate(username, authentication.getCredentials().toString()); } }
@Override public DescriptorImpl getDescriptor() { return (DescriptorImpl) super.getDescriptor(); }
protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException { return AbstractPasswordBasedSecurityRealm.this.doAuthenticate(username, authentication.getCredentials().toString()); } }
private UserDetails doAuthenticate(String username, String password) throws AuthenticationException { try { UserDetails user = authenticate(username, password); SecurityListener.fireAuthenticated(user); return user; } catch (AuthenticationException x) { SecurityListener.fireFailedToAuthenticate(username); throw x; } }
protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException { return AbstractPasswordBasedSecurityRealm.this.doAuthenticate(username, authentication.getCredentials().toString()); } }
@Override public SecurityComponents createSecurityComponents() { Binding binding = new Binding(); binding.setVariable("authenticator", new Authenticator()); BeanBuilder builder = new BeanBuilder(); builder.parse(Hudson.getInstance() .servletContext .getResourceAsStream("/WEB-INF/security/AbstractPasswordBasedSecurityRealm.groovy"), binding); WebApplicationContext context = builder.createApplicationContext(); return new SecurityComponents( findBean(AuthenticationManager.class, context), this); }
/** * Authenticate a login attempt. * This method is the heart of a {@link AbstractPasswordBasedSecurityRealm}. * <p/> * <p/> * If the user name and the password pair matches, retrieve the information about this user and * return it as a {@link UserDetails} object. {@link org.springframework.security.userdetails.User} is a convenient * implementation to use, but if your backend offers additional data, you may want to use your own subtype * so that the rest of Hudson can use those additional information (such as e-mail address --- see * {@link MailAddressResolver}.) * <p/> * <p/> * Properties like {@link UserDetails#getPassword()} make no sense, so just return an empty value from it. * The only information that you need to pay real attention is {@link UserDetails#getAuthorities()}, which * is a list of roles/groups that the user is in. At minimum, this must contain {@link #AUTHENTICATED_AUTHORITY} * (which indicates that this user is authenticated and not anonymous), but if your backend supports a notion * of groups, you should make sure that the authorities contain one entry per one group. This enables * users to control authorization based on groups. * <p/> * <p/> * If the user name and the password pair doesn't match, throw {@link AuthenticationException} to reject the login * attempt. * If authentication was successful - HUDSON_USER environment variable will be set * <a href='http://issues.hudson-ci.org/browse/HUDSON-4463'>HUDSON-4463</a> */ protected UserDetails doAuthenticate(String username, String password) throws AuthenticationException { UserDetails userDetails = authenticate(username, password); EnvVars.setHudsonUserEnvVar(userDetails.getUsername()); return userDetails; }
protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException { return AbstractPasswordBasedSecurityRealm.this.doAuthenticate(username, authentication.getCredentials().toString()); } }
@Override public SecurityComponents createSecurityComponents() { Binding binding = new Binding(); binding.setVariable("authenticator", new Authenticator()); BeanBuilder builder = new BeanBuilder(); builder.parse(Hudson.getInstance() .servletContext .getResourceAsStream("/WEB-INF/security/AbstractPasswordBasedSecurityRealm.groovy"), binding); WebApplicationContext context = builder.createApplicationContext(); return new SecurityComponents( findBean(AuthenticationManager.class, context), this); }
/** * Authenticate a login attempt. * This method is the heart of a {@link AbstractPasswordBasedSecurityRealm}. * <p/> * <p/> * If the user name and the password pair matches, retrieve the information about this user and * return it as a {@link UserDetails} object. {@link org.acegisecurity.userdetails.User} is a convenient * implementation to use, but if your backend offers additional data, you may want to use your own subtype * so that the rest of Hudson can use those additional information (such as e-mail address --- see * {@link MailAddressResolver}.) * <p/> * <p/> * Properties like {@link UserDetails#getPassword()} make no sense, so just return an empty value from it. * The only information that you need to pay real attention is {@link UserDetails#getAuthorities()}, which * is a list of roles/groups that the user is in. At minimum, this must contain {@link #AUTHENTICATED_AUTHORITY} * (which indicates that this user is authenticated and not anonymous), but if your backend supports a notion * of groups, you should make sure that the authorities contain one entry per one group. This enables * users to control authorization based on groups. * <p/> * <p/> * If the user name and the password pair doesn't match, throw {@link AuthenticationException} to reject the login * attempt. * If authentication was successful - HUDSON_USER environment variable will be set * <a href='http://issues.hudson-ci.org/browse/HUDSON-4463'>HUDSON-4463</a> */ protected UserDetails doAuthenticate(String username, String password) throws AuthenticationException { UserDetails userDetails = authenticate(username, password); EnvVars.setHudsonUserEnvVar(userDetails.getUsername()); return userDetails; }
public Authentication authenticate() throws AuthenticationException, IOException, InterruptedException { if (userName == null) { return Hudson.ANONYMOUS; // no authentication parameter. run as anonymous } if (passwordFile != null) { try { password = new FilePath(command.channel, passwordFile).readToString().trim(); } catch (IOException e) { throw new BadCredentialsException("Failed to read " + passwordFile, e); } } if (password == null) { password = command.channel.call(new InteractivelyAskForPassword()); } if (password == null) { throw new BadCredentialsException("No password specified"); } UserDetails d = AbstractPasswordBasedSecurityRealm.this.doAuthenticate(userName, password); return new UsernamePasswordAuthenticationToken(d, password, d.getAuthorities()); } };
@Override public SecurityComponents createSecurityComponents() { Binding binding = new Binding(); binding.setVariable("authenticator", new Authenticator()); BeanBuilder builder = new BeanBuilder(); builder.parse(Jenkins.getInstance().servletContext.getResourceAsStream("/WEB-INF/security/AbstractPasswordBasedSecurityRealm.groovy"),binding); WebApplicationContext context = builder.createApplicationContext(); return new SecurityComponents( findBean(AuthenticationManager.class, context), new ImpersonatingUserDetailsService(this)); }
/** * Authenticate a login attempt. * This method is the heart of a {@link AbstractPasswordBasedSecurityRealm}. * <p/> * <p/> * If the user name and the password pair matches, retrieve the information about this user and * return it as a {@link UserDetails} object. {@link org.acegisecurity.userdetails.User} is a convenient * implementation to use, but if your backend offers additional data, you may want to use your own subtype * so that the rest of Hudson can use those additional information (such as e-mail address --- see * {@link MailAddressResolver}.) * <p/> * <p/> * Properties like {@link UserDetails#getPassword()} make no sense, so just return an empty value from it. * The only information that you need to pay real attention is {@link UserDetails#getAuthorities()}, which * is a list of roles/groups that the user is in. At minimum, this must contain {@link #AUTHENTICATED_AUTHORITY} * (which indicates that this user is authenticated and not anonymous), but if your backend supports a notion * of groups, you should make sure that the authorities contain one entry per one group. This enables * users to control authorization based on groups. * <p/> * <p/> * If the user name and the password pair doesn't match, throw {@link AuthenticationException} to reject the login * attempt. * If authentication was successful - HUDSON_USER environment variable will be set * <a href='http://issues.hudson-ci.org/browse/HUDSON-4463'>HUDSON-4463</a> */ protected UserDetails doAuthenticate(String username, String password) throws AuthenticationException { UserDetails userDetails = authenticate(username, password); EnvVars.setHudsonUserEnvVar(userDetails.getUsername()); return userDetails; }
public Authentication authenticate() throws AuthenticationException, IOException, InterruptedException { if (userName == null) { return Hudson.ANONYMOUS; // no authentication parameter. run as anonymous } if (passwordFile != null) { try { password = new FilePath(command.channel, passwordFile).readToString().trim(); } catch (IOException e) { throw new BadCredentialsException("Failed to read " + passwordFile, e); } } if (password == null) { password = command.channel.call(new InteractivelyAskForPassword()); } if (password == null) { throw new BadCredentialsException("No password specified"); } UserDetails d = AbstractPasswordBasedSecurityRealm.this.doAuthenticate(userName, password); return new UsernamePasswordAuthenticationToken(d, password, d.getAuthorities()); } };
UserDetails userDetails = authenticate(username, password); EnvVars.setHudsonUserEnvVar(userDetails.getUsername()); return userDetails;
public Authentication authenticate() throws AuthenticationException, IOException, InterruptedException { if (userName == null) { return Hudson.ANONYMOUS; // no authentication parameter. run as anonymous } if (passwordFile != null) { try { password = new FilePath(command.channel, passwordFile).readToString().trim(); } catch (IOException e) { throw new BadCredentialsException("Failed to read " + passwordFile, e); } } if (password == null) { password = command.channel.call(new InteractivelyAskForPassword()); } if (password == null) { throw new BadCredentialsException("No password specified"); } UserDetails d = AbstractPasswordBasedSecurityRealm.this.doAuthenticate(userName, password); return new UsernamePasswordAuthenticationToken(d, password, d.getAuthorities()); } };
public Authentication authenticate() throws AuthenticationException, IOException, InterruptedException { if (userName == null) { return Hudson.ANONYMOUS; // no authentication parameter. run as anonymous } if (passwordFile != null) { try { password = new FilePath(command.channel, passwordFile).readToString().trim(); } catch (IOException e) { throw new BadCredentialsException("Failed to read " + passwordFile, e); } } if (password == null) { password = command.channel.call(new InteractivelyAskForPassword()); } if (password == null) { throw new BadCredentialsException("No password specified"); } UserDetails d = AbstractPasswordBasedSecurityRealm.this.doAuthenticate(userName, password); return new UsernamePasswordAuthenticationToken(d, password, d.getAuthorities()); } };