package com.packt.example.authorizationserver.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
@Configuration
@EnableAuthorizationServer
public class OAuth2AuthorizationServer extends
AuthorizationServerConfigurerAdapter {
@Autowired
private RedisConnectionFactory connectionFactory;
@Autowired
private AuthenticationManager authenticationManager;
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints)
throws Exception {
//@formatter:off
endpoints
.authenticationManager(authenticationManager)
.tokenStore(tokenStore());
//@formatter:on
}
@Bean
public TokenStore tokenStore() {
return new RedisTokenStore(connectionFactory);
}
@Override
public void configure(ClientDetailsServiceConfigurer clients)
throws Exception {
//@formatter:off
clients.inMemory()
.withClient("clientapp")
.secret("123456")
.redirectUris("http://localhost:9000/callback")
.authorizedGrantTypes("authorization_code",
"implicit", "password")
.scopes("read_profile", "read_contacts");
//@formatter:on
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
springBoot+security+oauth2 资源和认证分离的密码模式
共236个文件
xml:188个
class:12个
java:12个
4星 · 超过85%的资源 需积分: 41 211 下载量 124 浏览量
2018-08-09
10:18:11
上传
评论 4
收藏 57.72MB RAR 举报
温馨提示
springBoot+security+oauth2 资源和认证分离的密码模式
资源推荐
资源详情
资源评论
收起资源包目录
springBoot+security+oauth2 资源和认证分离的密码模式 (236个子文件)
User.class 4KB
User.class 4KB
OAuth2AuthorizationServer.class 4KB
WebSecurityConfig.class 3KB
OAuth2ResourceServer.class 3KB
CustomUserService.class 1KB
UserController.class 852B
AuthorizationServerApplication.class 791B
UserProfile.class 767B
ResourceServerApplication.class 766B
TestController.class 707B
UserRepository.class 489B
.gitignore 249B
.gitignore 249B
authorization-server.iml 13KB
resource-server.iml 13KB
authorization-server-0.0.1-SNAPSHOT.jar 33.19MB
resource-server-0.0.1-SNAPSHOT.jar 32.24MB
OAuth2AuthorizationServer.java 2KB
OAuth2ResourceServer.java 2KB
WebSecurityConfig.java 2KB
User.java 1KB
User.java 1KB
UserController.java 1KB
CustomUserService.java 939B
TestController.java 688B
UserProfile.java 396B
AuthorizationServerApplication.java 367B
UserRepository.java 355B
ResourceServerApplication.java 352B
inputFiles.lst 824B
inputFiles.lst 735B
createdFiles.lst 0B
createdFiles.lst 0B
.name 20B
.name 15B
authorization-server-0.0.1-SNAPSHOT.jar.original 10KB
resource-server-0.0.1-SNAPSHOT.jar.original 10KB
pom.properties 143B
pom.properties 138B
application.properties 57B
application.properties 57B
application.properties 41B
application.properties 41B
workspace.xml 50KB
workspace.xml 42KB
pom.xml 3KB
pom.xml 3KB
misc.xml 2KB
misc.xml 2KB
compiler.xml 1KB
compiler.xml 1KB
Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_4_RELEASE.xml 793B
Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_4_RELEASE.xml 793B
Maven__org_springframework_boot_spring_boot_starter_data_redis_1_5_4_RELEASE.xml 793B
Maven__org_springframework_boot_spring_boot_starter_data_redis_1_5_4_RELEASE.xml 793B
Maven__org_springframework_security_oauth_spring_security_oauth2_2_0_14_RELEASE.xml 784B
Maven__org_springframework_security_oauth_spring_security_oauth2_2_0_14_RELEASE.xml 784B
Maven__org_springframework_boot_spring_boot_starter_security_1_5_4_RELEASE.xml 779B
Maven__org_springframework_boot_spring_boot_starter_security_1_5_4_RELEASE.xml 779B
Maven__org_springframework_boot_spring_boot_starter_data_jpa_1_5_4_RELEASE.xml 779B
Maven__org_springframework_boot_spring_boot_starter_data_jpa_1_5_4_RELEASE.xml 779B
Maven__org_springframework_boot_spring_boot_starter_logging_1_5_4_RELEASE.xml 772B
Maven__org_springframework_boot_spring_boot_starter_logging_1_5_4_RELEASE.xml 772B
Maven__org_springframework_boot_spring_boot_starter_tomcat_1_5_4_RELEASE.xml 765B
Maven__org_springframework_boot_spring_boot_starter_tomcat_1_5_4_RELEASE.xml 765B
Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_4_RELEASE.xml 758B
Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_4_RELEASE.xml 758B
Maven__org_hibernate_common_hibernate_commons_annotations_5_0_1_Final.xml 756B
Maven__org_hibernate_common_hibernate_commons_annotations_5_0_1_Final.xml 756B
Maven__org_springframework_security_spring_security_config_4_2_3_RELEASE.xml 753B
Maven__org_springframework_security_spring_security_config_4_2_3_RELEASE.xml 753B
Maven__org_springframework_boot_spring_boot_starter_jdbc_1_5_4_RELEASE.xml 751B
Maven__org_springframework_boot_spring_boot_starter_jdbc_1_5_4_RELEASE.xml 751B
Maven__org_springframework_boot_spring_boot_starter_test_1_5_4_RELEASE.xml 751B
Maven__org_springframework_boot_spring_boot_starter_test_1_5_4_RELEASE.xml 751B
Maven__org_springframework_boot_spring_boot_starter_web_1_5_4_RELEASE.xml 744B
Maven__org_springframework_boot_spring_boot_starter_aop_1_5_4_RELEASE.xml 744B
Maven__org_hibernate_javax_persistence_hibernate_jpa_2_1_api_1_0_0_Final.xml 744B
Maven__org_springframework_boot_spring_boot_starter_aop_1_5_4_RELEASE.xml 744B
Maven__org_hibernate_javax_persistence_hibernate_jpa_2_1_api_1_0_0_Final.xml 744B
Maven__org_springframework_boot_spring_boot_starter_web_1_5_4_RELEASE.xml 744B
Maven__org_springframework_security_spring_security_core_4_2_3_RELEASE.xml 739B
Maven__org_springframework_security_spring_security_test_4_2_3_RELEASE.xml 739B
Maven__org_springframework_security_spring_security_test_4_2_3_RELEASE.xml 739B
Maven__org_springframework_security_spring_security_core_4_2_3_RELEASE.xml 739B
Maven__org_springframework_security_spring_security_web_4_2_3_RELEASE.xml 732B
Maven__org_springframework_security_spring_security_web_4_2_3_RELEASE.xml 732B
Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml 724B
Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml 724B
Maven__org_springframework_data_spring_data_commons_1_13_4_RELEASE.xml 723B
Maven__org_springframework_data_spring_data_commons_1_13_4_RELEASE.xml 723B
Maven__org_springframework_data_spring_data_keyvalue_1_2_4_RELEASE.xml 723B
Maven__org_springframework_data_spring_data_keyvalue_1_2_4_RELEASE.xml 723B
Maven__org_springframework_spring_context_support_4_3_9_RELEASE.xml 717B
Maven__org_springframework_spring_context_support_4_3_9_RELEASE.xml 717B
Maven__org_springframework_boot_spring_boot_starter_1_5_4_RELEASE.xml 716B
Maven__org_springframework_boot_spring_boot_starter_1_5_4_RELEASE.xml 716B
Maven__org_springframework_data_spring_data_redis_1_8_4_RELEASE.xml 702B
Maven__org_springframework_data_spring_data_redis_1_8_4_RELEASE.xml 702B
共 236 条
- 1
- 2
- 3
zhangsanfeng2009
- 粉丝: 14
- 资源: 24
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页