@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)); }
basicProcessingFilter.setAuthenticationManager(sc.getManager()); BasicProcessingFilterEntryPoint basicProcessingFilterEntryPoint = new BasicProcessingFilterEntryPoint(); basicProcessingFilterEntryPoint.setRealmName("Hudson"); authenticationProcessingFilter.setAuthenticationManager(sc.getManager()); authenticationProcessingFilter.setRememberMeServices(sc.getRememberMe()); authenticationProcessingFilter.setAuthenticationFailureUrl("/loginError"); authenticationProcessingFilter.setDefaultTargetUrl("/"); rememberMeProcessingFilter.setRememberMeServices(sc.getRememberMe()); rememberMeProcessingFilter.setAuthenticationManager(sc.getManager()); filters.add(rememberMeProcessingFilter);
return new SecurityComponents(providerManager, new LDAPUserDetailsService(ldapUserSearch, authoritiesPopulator));
return new SecurityComponents(providerManager, userDetailsService);
new org.springframework.security.web.authentication.www.BasicAuthenticationFilter(sc.getManager()); BasicAuthenticationEntryPoint basicProcessingFilterEntryPoint = new BasicAuthenticationEntryPoint(); basicProcessingFilterEntryPoint.setRealmName("Hudson"); authenticationProcessingFilter.setAuthenticationManager(sc.getManager()); authenticationProcessingFilter.setRememberMeServices(sc.getRememberMe()); filters.add(authenticationProcessingFilter); RememberMeAuthenticationFilter rememberMeProcessingFilter = new RememberMeAuthenticationFilter(sc.getManager(), sc.getRememberMe());
return new SecurityComponents(providerManager, new LDAPUserDetailsService(ldapUserSearch, authoritiesPopulator));
public SecurityComponents createSecurityComponents() { BeanBuilder builder = new BeanBuilder(getClass().getClassLoader()); Binding binding = new Binding(); binding.setVariable("realm", this); InputStream i = getClass().getResourceAsStream("ActiveDirectory.groovy"); try { builder.parse(i, binding); } finally { IOUtils.closeQuietly(i); } WebApplicationContext context = builder.createApplicationContext(); //final AbstractActiveDirectoryAuthenticationProvider adp = findBean(AbstractActiveDirectoryAuthenticationProvider.class, context); findBean(AbstractActiveDirectoryAuthenticationProvider.class, context); //Keeping the call because there might be side effects? final UserDetailsService uds = findBean(UserDetailsService.class, context); TokenBasedRememberMeServices2 rms = new TokenBasedRememberMeServices2() { public Authentication autoLogin(HttpServletRequest request, HttpServletResponse response) { try { return super.autoLogin(request, response); } catch (Exception e) {// TODO: this check is made redundant with 1.556, but needed with earlier versions cancelCookie(request, response, "Failed to handle remember-me cookie: "+Functions.printThrowable(e)); return null; } } }; rms.setUserDetailsService(uds); rms.setKey(Jenkins.getActiveInstance().getSecretKey()); rms.setParameter("remember_me"); // this is the form field name in login.jelly return new SecurityComponents( findBean(AuthenticationManager.class, context), uds, rms); }
@Override public SecurityComponents createSecurityComponents() { // this does all the hard work Authenticator authenticator = new Authenticator(); // these providers apply everywhere RememberMeAuthenticationProvider rememberMeAuthenticationProvider = new RememberMeAuthenticationProvider(); rememberMeAuthenticationProvider.setKey(Hudson.getInstance().getSecretKey()); // this doesn't mean we allow anonymous access. // we just authenticate anonymous users as such, // so that later authorization can reject them if so configured AnonymousAuthenticationProvider anonymousAuthenticationProvider = new AnonymousAuthenticationProvider(); anonymousAuthenticationProvider.setKey("anonymous"); AuthenticationProvider[] authenticationProvider = { authenticator, rememberMeAuthenticationProvider, anonymousAuthenticationProvider }; ProviderManager providerManager = new ProviderManager(); providerManager.setProviders(Arrays.asList(authenticationProvider)); return new SecurityComponents(providerManager); }
public SecurityComponents createSecurityComponents() { Binding binding = new Binding(); binding.setVariable("instance", this); BeanBuilder builder = new BeanBuilder(); builder.parse(Hudson.getInstance().servletContext.getResourceAsStream("/WEB-INF/security/PAMSecurityRealm.groovy"),binding); WebApplicationContext context = builder.createApplicationContext(); return new SecurityComponents( findBean(AuthenticationManager.class, context), new UserDetailsService() { public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { if(!UnixUser.exists(username)) throw new UsernameNotFoundException("No such Unix user: "+username); // return some dummy instance return new User(username,"",true,true,true,true, new GrantedAuthority[]{AUTHENTICATED_AUTHORITY}); } } ); }
@Override public SecurityComponents createSecurityComponents() { // this does all the hard work Authenticator authenticator = new Authenticator(); // these providers apply everywhere RememberMeAuthenticationProvider rememberMeAuthenticationProvider = new RememberMeAuthenticationProvider(); rememberMeAuthenticationProvider.setKey(HudsonSecurityEntitiesHolder.getHudsonSecurityManager().getSecretKey()); // this doesn't mean we allow anonymous access. // we just authenticate anonymous users as such, // so that later authorization can reject them if so configured AnonymousAuthenticationProvider anonymousAuthenticationProvider = new AnonymousAuthenticationProvider(); anonymousAuthenticationProvider.setKey("anonymous"); AuthenticationProvider[] authenticationProvider = { authenticator, rememberMeAuthenticationProvider, anonymousAuthenticationProvider }; ProviderManager providerManager = new ProviderManager(); providerManager.setProviders(Arrays.asList(authenticationProvider)); return new SecurityComponents(providerManager, this); }
public SecurityComponents createSecurityComponents() { Binding binding = new Binding(); binding.setVariable("instance", this); BeanBuilder builder = new BeanBuilder(); builder.parse(Hudson.getInstance().servletContext.getResourceAsStream("/WEB-INF/security/PAMSecurityRealm.groovy"),binding); WebApplicationContext context = builder.createApplicationContext(); return new SecurityComponents( findBean(AuthenticationManager.class, context), new UserDetailsService() { public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { if(!UnixUser.exists(username)) throw new UsernameNotFoundException("No such Unix user: "+username); // return some dummy instance return new User(username,"",true,true,true,true, new GrantedAuthority[]{AUTHENTICATED_AUTHORITY}); } } ); }
/** * Acegi has this notion that first an {@link org.acegisecurity.Authentication} object is created * by collecting user information and then the act of authentication is done * later (by {@link org.acegisecurity.AuthenticationManager}) to verify it. But in case of OpenID, * we create an {@link org.acegisecurity.Authentication} only after we verified the user identity, * so {@link org.acegisecurity.AuthenticationManager} becomes no-op. */ @Override public SecurityComponents createSecurityComponents() { return new SecurityComponents( new AuthenticationManager() { public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (authentication instanceof AnonymousAuthenticationToken) return authentication; throw new BadCredentialsException("Unexpected authentication type: " + authentication); } } ); }
@Override public SecurityComponents createSecurityComponents() { return new SecurityComponents(new AuthenticationManager() { public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (authentication instanceof GithubAuthenticationToken) return authentication; throw new BadCredentialsException( "Unexpected authentication type: " + authentication); } }, new UserDetailsService() { public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { throw new UsernameNotFoundException(username); } }); }
public SecurityComponents createSecurityComponents() { return new SecurityComponents(this); }
public SecurityComponents(AuthenticationManager manager, UserDetailsService userDetails) { this(manager, userDetails, createRememberMeService(userDetails)); }
public SecurityComponents createSecurityComponents() { return new SecurityComponents(this); }
public SecurityComponents createSecurityComponents() { return new SecurityComponents(this); }
public SecurityComponents(AuthenticationManager manager, UserDetailsService userDetails) { this(manager, userDetails, createRememberMeService(userDetails)); }
public SecurityComponents(AuthenticationManager manager, UserDetailsService userDetails) { this(manager, userDetails, createRememberMeService(userDetails)); }
public SecurityComponents createSecurityComponents() { return new SecurityComponents(this); }