@SuppressWarnings("unchecked") private void registerDefaultAuthenticationEntryPoint(HttpSecurity http) { ExceptionHandlingConfigurer<HttpSecurity> exceptionHandling = http .getConfigurer(ExceptionHandlingConfigurer.class); if (exceptionHandling == null) { return; } if (authenticationEntryPoint==null) { BasicAuthenticationEntryPoint basicEntryPoint = new BasicAuthenticationEntryPoint(); basicEntryPoint.setRealmName(realm); authenticationEntryPoint = basicEntryPoint; } ContentNegotiationStrategy contentNegotiationStrategy = http.getSharedObject(ContentNegotiationStrategy.class); if (contentNegotiationStrategy == null) { contentNegotiationStrategy = new HeaderContentNegotiationStrategy(); } MediaTypeRequestMatcher preferredMatcher = new MediaTypeRequestMatcher(contentNegotiationStrategy, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.APPLICATION_XML, MediaType.MULTIPART_FORM_DATA, MediaType.TEXT_XML); preferredMatcher.setIgnoredMediaTypes(Collections.singleton(MediaType.ALL)); exceptionHandling.defaultAuthenticationEntryPointFor(postProcess(authenticationEntryPoint), preferredMatcher); }
@Override public void initializeFromConfig(SecurityNamedServiceConfig config) throws IOException { super.initializeFromConfig(config); try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("No MD5 algorithm available!"); } aep = new BasicAuthenticationEntryPoint(); aep.setRealmName(GeoServerSecurityManager.REALM); try { aep.afterPropertiesSet(); } catch (Exception e) { throw new IOException(e); } BasicAuthenticationFilterConfig authConfig = (BasicAuthenticationFilterConfig) config; BasicAuthenticationFilter filter = new BasicAuthenticationFilter(getSecurityManager().authenticationManager(), aep); if (authConfig.isUseRememberMe()) { filter.setRememberMeServices(securityManager.getRememberMeService()); GeoServerWebAuthenticationDetailsSource s = new GeoServerWebAuthenticationDetailsSource(); filter.setAuthenticationDetailsSource(s); } filter.afterPropertiesSet(); getNestedFilters().add(filter); }
public BasicAuthenticationEntryPoint getAuthenticationEntryPoint() { BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint(); basicAuthenticationEntryPoint.setRealmName("atlas.com"); return basicAuthenticationEntryPoint; }
@Bean BasicAuthenticationEntryPoint basicAuthEntryPoint() { BasicAuthenticationEntryPoint bauth = new BasicAuthenticationEntryPoint(); bauth.setRealmName("GAURAVBYTES"); return bauth; }
.anyRequest().authenticated() .and().anonymous().disable() .exceptionHandling().authenticationEntryPoint(new BasicAuthenticationEntryPoint() { @Override public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException, ServletException {
@Override protected void configure(HttpSecurity http) throws Exception { http.httpBasic().authenticationEntryPoint(getBasicAuthenticationEntryPoint()); } @Bean public BasicAuthenticationEntryPoint getBasicAuthenticationEntryPoint(){ BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint(); basicAuthenticationEntryPoint.setRealmName("Basic Authentication"); return basicAuthenticationEntryPoint; } @Bean @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth .userDetailsService(userDetailsService) .passwordEncoder(passwordEncoder()); }
/** * Shortcut for {@link #authenticationEntryPoint(AuthenticationEntryPoint)} * specifying a {@link BasicAuthenticationEntryPoint} with the specified * realm name. * * @param realmName * the HTTP Basic realm to use * @return {@link HttpBasicConfigurer} for additional customization * @throws Exception */ public HttpBasicConfigurer<B> realmName(String realmName) throws Exception { BasicAuthenticationEntryPoint basicAuthEntryPoint = new BasicAuthenticationEntryPoint(); basicAuthEntryPoint.setRealmName(realmName); basicAuthEntryPoint.afterPropertiesSet(); return authenticationEntryPoint(basicAuthEntryPoint); }
BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint(); basicAuthenticationEntryPoint.setRealmName(realm); basicAuthenticationEntryPoint.afterPropertiesSet();
final BasicAuthenticationEntryPoint wsAuthenticationEntryPoint = new BasicAuthenticationEntryPoint(); wsAuthenticationEntryPoint.setRealmName("My Realm"); return wsAuthenticationEntryPoint;
@Override public void initializeFromConfig(SecurityNamedServiceConfig config) throws IOException { super.initializeFromConfig(config); // anything to set here? maybe the cache config aep = new BasicAuthenticationEntryPoint(); aep.setRealmName(GeoServerSecurityManager.REALM); try { aep.afterPropertiesSet(); } catch (Exception e) { throw new IOException(e); } // BasicAuthenticationFilterConfig authConfig = (BasicAuthenticationFilterConfig) config; SecurityNamedServiceConfig authCfg = securityManager.loadAuthenticationProviderConfig("geofence"); GeoFenceAuthenticationProvider geofenceAuthProvider = geofenceAuth.createAuthenticationProvider(authCfg); BasicAuthenticationFilter filter = new BasicAuthenticationFilter(geofenceAuthProvider, aep); // if (authConfig.isUseRememberMe()) { // filter.setRememberMeServices(securityManager.getRememberMeService()); // GeoServerWebAuthenticationDetailsSource s = new // GeoServerWebAuthenticationDetailsSource(); // filter.setAuthenticationDetailsSource(s); // } filter.afterPropertiesSet(); getNestedFilters().add(filter); }
public FilterChainProxy springSecurityFilterChain() throws Exception { BasicAuthenticationEntryPoint entryPoint = new BasicAuthenticationEntryPoint(); entryPoint.setRealmName("AppName Realm");
@Override protected void configure(HttpSecurity http) throws Exception { final BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint(); basicAuthenticationEntryPoint.setRealmName(SecurityConfigUtils.BASIC_AUTH_REALM_NAME); basicAuthenticationEntryPoint.afterPropertiesSet();
@Override public void initializeFromConfig(SecurityNamedServiceConfig config) throws IOException { super.initializeFromConfig(config); GeoFenceAuthFilterConfig cfg = (GeoFenceAuthFilterConfig) config; // anything to set here? maybe the cache config aep = new BasicAuthenticationEntryPoint(); aep.setRealmName(GeoServerSecurityManager.REALM); try { aep.afterPropertiesSet(); } catch (Exception e) { throw new IOException(e); } // BasicAuthenticationFilterConfig authConfig = (BasicAuthenticationFilterConfig) config; SecurityNamedServiceConfig authCfg = securityManager.loadAuthenticationProviderConfig("geofence"); GeoFenceAuthenticationProvider geofenceAuthProvider = geofenceAuth.createAuthenticationProvider(authCfg); BasicAuthenticationFilter filter = new BasicAuthenticationFilter(geofenceAuthProvider, aep); // if (authConfig.isUseRememberMe()) { // filter.setRememberMeServices(securityManager.getRememberMeService()); // GeoServerWebAuthenticationDetailsSource s = new // GeoServerWebAuthenticationDetailsSource(); // filter.setAuthenticationDetailsSource(s); // } filter.afterPropertiesSet(); getNestedFilters().add(filter); }
@Override protected void configure(HttpSecurity http) throws Exception { final BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint(); basicAuthenticationEntryPoint.setRealmName(securityProperties.getBasic().getRealm()); basicAuthenticationEntryPoint.afterPropertiesSet();
new BrowserDetectingContentNegotiationStrategy(), MediaType.TEXT_HTML); final BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint(); basicAuthenticationEntryPoint.setRealmName(securityProperties.getBasic().getRealm()); basicAuthenticationEntryPoint.afterPropertiesSet();
@SuppressWarnings("unchecked") private void registerDefaultAuthenticationEntryPoint(HttpSecurity http) { ExceptionHandlingConfigurer<HttpSecurity> exceptionHandling = http .getConfigurer(ExceptionHandlingConfigurer.class); if (exceptionHandling == null) { return; } if (authenticationEntryPoint==null) { BasicAuthenticationEntryPoint basicEntryPoint = new BasicAuthenticationEntryPoint(); basicEntryPoint.setRealmName(realm); authenticationEntryPoint = basicEntryPoint; } ContentNegotiationStrategy contentNegotiationStrategy = http.getSharedObject(ContentNegotiationStrategy.class); if (contentNegotiationStrategy == null) { contentNegotiationStrategy = new HeaderContentNegotiationStrategy(); } MediaTypeRequestMatcher preferredMatcher = new MediaTypeRequestMatcher(contentNegotiationStrategy, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.APPLICATION_XML, MediaType.MULTIPART_FORM_DATA, MediaType.TEXT_XML); preferredMatcher.setIgnoredMediaTypes(Collections.singleton(MediaType.ALL)); exceptionHandling.defaultAuthenticationEntryPointFor(postProcess(authenticationEntryPoint), preferredMatcher); }
@Override protected void configure(final HttpSecurity http) throws Exception { final BasicAuthenticationEntryPoint basicAuthEntryPoint = new BasicAuthenticationEntryPoint(); basicAuthEntryPoint.setRealmName(securityProperties.getBasicRealm());
BasicAuthenticationEntryPoint basicProcessingFilterEntryPoint = new BasicAuthenticationEntryPoint(); basicProcessingFilterEntryPoint.setRealmName("Hudson"); basicProcessingFilter.setAuthenticationEntryPoint(basicProcessingFilterEntryPoint);
@Override protected void configure(final HttpSecurity http) throws Exception { final BasicAuthenticationEntryPoint basicAuthEntryPoint = new BasicAuthenticationEntryPoint(); basicAuthEntryPoint.setRealmName(springSecurityProperties.getBasic().getRealm());
final RequestMatcher textHtmlMatcher = new MediaTypeRequestMatcher(contentNegotiationStrategy, MediaType.TEXT_HTML); final BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint(); basicAuthenticationEntryPoint.setRealmName(securityProperties.getBasic().getRealm()); basicAuthenticationEntryPoint.afterPropertiesSet();