本文整理汇总了Java中org.springframework.security.config.annotation.web.builders.HttpSecurity.getSharedObject方法的典型用法代码示例。如果您正苦于以下问题:Java HttpSecurity.getSharedObject方法的具体用法?Java HttpSecurity.getSharedObject怎么用?Java HttpSecurity.getSharedObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.config.annotation.web.builders.HttpSecurity
的用法示例。
在下文中一共展示了HttpSecurity.getSharedObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //导入方法依赖的package包/类
@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
}
示例2: configure
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* In addition {@link #configure(HttpSecurity)} will call {@link #init(HttpSecurity)} in order to be used without
* {@link HttpSecurity#apply(SecurityConfigurerAdapter)} usage, related to
* https://github.com/spring-projects/spring-security/issues/4422 issue.
*
* Thus when using
*
* <pre>{@code
* CasHttpSecurityConfigurer.cas().configure(http);
* }</pre>
*
* {@code configure(http)} will also call {@link CasHttpSecurityConfigurerAdapter#init(HttpSecurity)} and no need
* to write following duplicates
*
* <pre>{@code
* CasHttpSecurityConfigurer.cas().init(http);
* CasHttpSecurityConfigurer.cas().configure(http);
* }</pre>
*/
@Override
public void configure(HttpSecurity http) throws Exception {
init(http);
ApplicationContext context = http.getSharedObject(ApplicationContext.class);
getCasHttpSecurityConfigurerAdapter(context).configure(http);
}
示例3: init
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* @deprecated use {@link #configure(HttpSecurity)} instead.
* Will not be removed but until this issue was not treat
* https://github.com/spring-projects/spring-security/issues/4422 I still prefer using this
* {@link SecurityConfigurerAdapter} directly like following
*
* <pre>{@code
* CasHttpSecurityConfigurer.cas().configure(http);
* }</pre>
*
* instead of
*
* <pre>{@code
* http.apply(CasHttpSecurityConfigurer.cas());
* }</pre>
*/
@Override
@Deprecated
public void init(HttpSecurity http) throws Exception {
if (!isInitialized) {
ApplicationContext context = http.getSharedObject(ApplicationContext.class);
getCasHttpSecurityConfigurerAdapter(context).init(http);
isInitialized = true;
}
}