Java Code Examples for org.springframework.security.config.annotation.web.builders.httpsecurity#getSharedObject()
The following examples show how to use
org.springframework.security.config.annotation.web.builders.httpsecurity#getSharedObject() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XAuthDslConfigurer.java From Spring with Apache License 2.0 | 5 votes |
@Override public void configure(HttpSecurity builder) throws Exception { ApplicationContext context = builder.getSharedObject(ApplicationContext.class); XAuthTokenFilter xAuthTokenFilter = context.getBean(XAuthTokenFilter.class); builder.addFilterBefore(xAuthTokenFilter, UsernamePasswordAuthenticationFilter.class); }
Example 2
Source File: JuiserAuthenticationFilterRegistrar.java From juiser with Apache License 2.0 | 5 votes |
@Override public void init(HttpSecurity http) throws Exception { // autowire this bean ApplicationContext context = http.getSharedObject(ApplicationContext.class); context.getAutowireCapableBeanFactory().autowireBean(this); boolean springSecurityEnabled = forwardedHeaderConfig.getJwt() instanceof SpringSecurityJwtConfig; if (springSecurityEnabled) { String headerName = forwardedHeaderConfig.getName(); HeaderAuthenticationFilter filter = new HeaderAuthenticationFilter(headerName, authenticationManager); http.addFilterBefore(filter, UsernamePasswordAuthenticationFilter.class); } //else juiser.security.enabled is false or spring security is disabled via a property }