当前位置: 首页>>代码示例>>Java>>正文


Java HttpSecurity.getSharedObject方法代码示例

本文整理汇总了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
}
 
开发者ID:juiser,项目名称:juiser,代码行数:16,代码来源:JuiserAuthenticationFilterRegistrar.java

示例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);
}
 
开发者ID:kakawait,项目名称:cas-security-spring-boot-starter,代码行数:27,代码来源:CasHttpSecurityConfigurer.java

示例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;
    }
}
 
开发者ID:kakawait,项目名称:cas-security-spring-boot-starter,代码行数:27,代码来源:CasHttpSecurityConfigurer.java


注:本文中的org.springframework.security.config.annotation.web.builders.HttpSecurity.getSharedObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。