Spring Security默认参数配置

SpringSecurity 配置详解
本文详细介绍了SpringSecurity内置配置参数及其默认值,包括基本的身份验证设置、OAuth2客户端和服务资源配置等内容。

Spring Security 内置属性参数

Spring Boot 提供的内置配置参数以security为前缀,具体属性如下:

# SECURITY (SecurityProperties 类中)
security.basic.authorize-mode=role                  # 应用授权模式,ROLE=成员必须是安全的角色,AUTHENTICATED=经过身份                                                                                  验证的用户,NONE=没有设置安全授权
security.basic.enabled=true                              # 启用基本身份认证
security.basic.path=/**                                      # 拦截策略,以逗号分隔
security.basic.realm=Spring                             # HTTP基本realm
security.enable-csrf=false                                 # 启用csrf支持
security.filter-order=0                                        # 过滤器执行顺序
security.filter-dispatcher-types=ASYNC, FORWARD, INCLUDE, REQUEST # security 过滤器链dispatcher类型
security.headers.cache=true                             # 启用缓存控制 HTTP headers.
security.headers.content-type=true                   # 启用 "X-Content-Type-Options" header.
security.headers.frame=true                             # 启用 "X-Frame-Options" header.
security.headers.hsts=                                      # HTTP Strict Transport Security (HSTS) mode (none, domain, all).
security.headers.xss=true                                 # 启用跨域脚本 (XSS) 保护.
security.ignored=                                              # 安全策略,以逗号分隔
security.require-ssl=false                                  # 启用所有请求SSL
security.sessions=stateless                             # Session 创建策略(always, never, if_required, stateless).
security.user.name=user                                  # 默认用户名
security.user.password=                                 # 默认用户名密码
security.user.role=USER                                 # 默认用户角色

# SECURITY OAUTH2 CLIENT (OAuth2ClientProperties 类中)
security.oauth2.client.client-id=                      # OAuth2 client id.
security.oauth2.client.client-secret=               # OAuth2 client secret. A random secret is generated by default

# SECURITY OAUTH2 RESOURCES (ResourceServerProperties 类中)
security.oauth2.resource.id=                        # Identifier of the resource.
security.oauth2.resource.jwt.key-uri=         # The URI of the JWT token. Can be set if the value is not available and the key is public.
security.oauth2.resource.jwt.key-value=     # The verification key of the JWT token. Can either be a symmetric secret or PEM-encoded RSA public key.
security.oauth2.resource.prefer-token-info=true # Use the token info, can be set to false to use the user info.
security.oauth2.resource.service-id=resource #
security.oauth2.resource.token-info-uri= # URI of the token decoding endpoint.
security.oauth2.resource.token-type= # The token type to send when using the userInfoUri.
security.oauth2.resource.user-info-uri= # URI of the user endpoint.

# SECURITY OAUTH2 SSO (OAuth2SsoProperties 类中)
security.oauth2.sso.filter-order= # Filter order to apply if not providing an explicit WebSecurityConfigurerAdapter
security.oauth2.sso.login-path=/login # Path to the login page, i.e. the one that triggers the redirect to the OAuth2 Authorization Server

 

以上是官方给出的配置属性以及默认值列表。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值