本文整理汇总了Java中org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder类的典型用法代码示例。如果您正苦于以下问题:Java InMemoryClientDetailsServiceBuilder类的具体用法?Java InMemoryClientDetailsServiceBuilder怎么用?Java InMemoryClientDetailsServiceBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InMemoryClientDetailsServiceBuilder类属于org.springframework.security.oauth2.config.annotation.builders包,在下文中一共展示了InMemoryClientDetailsServiceBuilder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: clientDetailsService
import org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder; //导入依赖的package包/类
private ClientDetailsService clientDetailsService() throws Exception {
// @formatter:off
return new InMemoryClientDetailsServiceBuilder()
.withClient("clientapp")
.authorizedGrantTypes("password", "refresh_token")
.authorities("USER")
.scopes("read", "write")
.secret("123456")
.and()
.withClient("clientapp2")
.authorizedGrantTypes("client_credentials")
.authorities("USER")
.scopes("read", "write")
.secret("123456")
.and()
.withClient("clientapp3")
.authorizedGrantTypes("authorization_code")
.authorities("USER")
.redirectUris(
"http://localhost:5000/login.html",
"http://localhost:5000/diff_login.html")
.scopes("read", "write")
.secret("123456")
.and().build();
// @formatter:on
}
开发者ID:petrbouda,项目名称:joyrest,代码行数:27,代码来源:InMemoryOAuthConfiguration.java
示例2: configure
import org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
ClientDetailsServiceBuilder<InMemoryClientDetailsServiceBuilder>.ClientBuilder builder = clients
.inMemory().withClient(this.details.getClientId());
builder.secret(this.details.getClientSecret())
.resourceIds(this.details.getResourceIds().toArray(new String[0]))
.authorizedGrantTypes(
this.details.getAuthorizedGrantTypes().toArray(new String[0]))
.authorities(
AuthorityUtils.authorityListToSet(this.details.getAuthorities())
.toArray(new String[0]))
.scopes(this.details.getScope().toArray(new String[0]));
if (this.details.getRegisteredRedirectUri() != null) {
builder.redirectUris(
this.details.getRegisteredRedirectUri().toArray(new String[0]));
}
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:OAuth2AuthorizationServerConfiguration.java
示例3: configure
import org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
ClientDetailsServiceBuilder<InMemoryClientDetailsServiceBuilder>.ClientBuilder builder = clients
.inMemory().withClient(this.details.getClientId());
builder.secret(this.details.getClientSecret())
.resourceIds(this.details.getResourceIds().toArray(new String[0]))
.authorizedGrantTypes(
this.details.getAuthorizedGrantTypes().toArray(new String[0]))
.authorities(
AuthorityUtils.authorityListToSet(this.details.getAuthorities())
.toArray(new String[0]))
.scopes(this.details.getScope().toArray(new String[0]));
if (this.details.getAutoApproveScopes() != null) {
builder.autoApprove(
this.details.getAutoApproveScopes().toArray(new String[0]));
}
if (this.details.getAccessTokenValiditySeconds() != null) {
builder.accessTokenValiditySeconds(
this.details.getAccessTokenValiditySeconds());
}
if (this.details.getRefreshTokenValiditySeconds() != null) {
builder.refreshTokenValiditySeconds(
this.details.getRefreshTokenValiditySeconds());
}
if (this.details.getRegisteredRedirectUri() != null) {
builder.redirectUris(
this.details.getRegisteredRedirectUri().toArray(new String[0]));
}
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:31,代码来源:OAuth2AuthorizationServerConfiguration.java
示例4: OAuthConfig
import org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder; //导入依赖的package包/类
public OAuthConfig() throws Exception {
ClientDetailsService csvc = new InMemoryClientDetailsServiceBuilder()
.withClient("mobile").authorizedGrantTypes("password")
.authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT")
.scopes("read","write").resourceIds("prublisher")
.accessTokenValiditySeconds(3600).and().build();
UserDetailsService svc = new InMemoryUserDetailsManager(
Arrays.asList(
User.create("publisher", "publisher", MobileClient.ROLE_PUBLISHER),
User.create("subscriber", "subscriber", MobileClient.ROLE_SUBSCRIBER)));
combinedService_ = new ClientAndUserDetailsService(csvc,svc);
}
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:16,代码来源:OAuth2SecurityConfiguration.java
示例5: configInMemory
import org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
protected void configInMemory(ClientDetailsServiceConfigurer clients) throws Exception{
Map<String, MemoryUser> clientUsers = oauth2Properties.getAuthorizationServer().getClientDetails();
InMemoryClientDetailsServiceBuilder inMemory = clients.inMemory();
clientUsers.forEach((user, config)->{
ClientBuilder cb = inMemory.withClient(user).secret(config.getSecret());
if(!LangUtils.isEmpty(config.getScopes())){
cb.scopes(config.getScopes());
}
if(!LangUtils.isEmpty(config.getAuthorities())){
cb.authorities(config.getAuthorities());
}
if(config.getAccessTokenValiditySeconds()!=null){
cb.accessTokenValiditySeconds(config.getAccessTokenValiditySeconds());
}
cb.autoApprove(config.isAutoApprove());
if(!LangUtils.isEmpty(config.getAutoApproveScopes())){
cb.autoApprove(config.getAutoApproveScopes());
}
if(!LangUtils.isEmpty(config.getResourceIds())){
cb.resourceIds(config.getResourceIds());
}
if(!LangUtils.isEmpty(config.getAuthorizedGrantTypes())){
cb.authorizedGrantTypes(config.getAuthorizedGrantTypes());
}
if(config.getRefreshTokenValiditySeconds()!=null){
cb.refreshTokenValiditySeconds(config.getRefreshTokenValiditySeconds());
}
if(!LangUtils.isEmpty(config.getRegisteredRedirectUris())){
cb.redirectUris(config.getRegisteredRedirectUris());
}
});
inMemory.build();
}
开发者ID:wayshall,项目名称:onetwo,代码行数:36,代码来源:AuthorizationServerConfiguration.java
示例6: OAuth2Config
import org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder; //导入依赖的package包/类
/**
*
* This constructor is used to setup the clients and users that will be able to login to the
* system. This is a VERY insecure setup that is using hard-coded lists of clients / users /
* passwords and should never be used for anything other than local testing
* on a machine that is not accessible via the Internet. Even if you use
* this code for testing, at the bare minimum, you should consider changing the
* passwords listed below and updating the VideoSvcClientApiTest.
*
* @param auth
* @throws Exception
*/
public OAuth2Config() throws Exception {
// If you were going to reuse this class in another
// application, this is one of the key sections that you
// would want to change
// Create a service that has the credentials for all our clients
ClientDetailsService csvc = new InMemoryClientDetailsServiceBuilder()
// Create a client that has "read" and "write" access to the
// video service
.withClient("mobile").authorizedGrantTypes("password")
.authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT")
.scopes("read","write").resourceIds("video")
.and()
// Create a second client that only has "read" access to the
// video service
.withClient("mobileReader").authorizedGrantTypes("password")
.authorities("ROLE_CLIENT")
.scopes("read").resourceIds("video")
.accessTokenValiditySeconds(3600).and().build();
// Create a series of hard-coded users.
UserDetailsService svc = new InMemoryUserDetailsManager(
Arrays.asList(
User.create("admin", "pass", "ADMIN", "USER"),
User.create("user0", "pass", "USER"),
User.create("user1", "pass", "USER"),
User.create("user2", "pass", "USER"),
User.create("user3", "pass", "USER"),
User.create("user4", "pass", "USER"),
User.create("user5", "pass", "USER")));
// Since clients have to use BASIC authentication with the client's id/secret,
// when sending a request for a password grant, we make each client a user
// as well. When the BASIC authentication information is pulled from the
// request, this combined UserDetailsService will authenticate that the
// client is a valid "user".
combinedService_ = new ClientAndUserDetailsService(csvc, svc);
}
开发者ID:juleswhite,项目名称:mobilecloud-15,代码行数:53,代码来源:OAuth2SecurityConfiguration.java
示例7: inMemory
import org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder; //导入依赖的package包/类
public InMemoryClientDetailsServiceBuilder inMemory() throws Exception { return null; }
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:2,代码来源:ClientDetailsServiceConfigurer.java
注:本文中的org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论