本文整理汇总了Java中org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer类的典型用法代码示例。如果您正苦于以下问题:Java ClientDetailsServiceConfigurer类的具体用法?Java ClientDetailsServiceConfigurer怎么用?Java ClientDetailsServiceConfigurer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClientDetailsServiceConfigurer类属于org.springframework.security.oauth2.config.annotation.configurers包,在下文中一共展示了ClientDetailsServiceConfigurer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
/*
For a better client design, this should be done by a ClientDetailsService (similar to UserDetailsService).
*/
clients.inMemory()
.withClient("web_app")
.scopes("openid")
.autoApprove(true)
.authorizedGrantTypes("implicit","refresh_token", "password", "authorization_code")
.and()
.withClient(jHipsterProperties.getSecurity().getClientAuthorization().getClientId())
.secret(jHipsterProperties.getSecurity().getClientAuthorization().getClientSecret())
.scopes("web-app")
.autoApprove(true)
.authorizedGrantTypes("client_credentials");
}
示例2: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
// configures two clients: client-a and client-b
// tokens generated for client-a, will be valid just for resource-a
// tokens generated for client-b, will be valid just for resource-b
clients.inMemory()
.withClient("client-a").secret("123")
.authorizedGrantTypes("password")
.scopes("read_profile", "read_contacts")
.authorities("introspection")
.resourceIds("resource-a")
.and()
.withClient("client-b").secret("123")
.authorizedGrantTypes("password")
.scopes("read_profile")
.authorities("introspection")
.resourceIds("resource-b");
}
示例3: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients
.inMemory()
.withClient("trusted-app")
.authorizedGrantTypes("client_credentials", "password", "refresh_token")
.authorities(Role.ROLE_TRUSTED_CLIENT.toString())
.scopes("read", "write")
.resourceIds(resourceId)
.accessTokenValiditySeconds(10)
.refreshTokenValiditySeconds(30000)
.secret("secret")
.and()
.withClient("register-app")
.authorizedGrantTypes("client_credentials")
.authorities(Role.ROLE_REGISTER.toString())
.scopes("registerUser")
.accessTokenValiditySeconds(10)
.refreshTokenValiditySeconds(10)
.resourceIds(resourceId)
.secret("secret");
}
示例4: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients)
throws Exception {
/*clients.jdbc(dataSource)
.withClient("sampleClientId")
.authorizedGrantTypes("implicit")
.scopes("read")
.autoApprove(true)
.and()
.withClient("clientIdPassword")
.secret("secret")
.authorizedGrantTypes(
"password","authorization_code", "refresh_token")
.scopes("read");*/
clients.jdbc(dataSource);
}
示例5: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的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]));
}
}
示例6: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的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
示例7: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("geocoderLocal-service")
.secret("geocoderLocal-pwd")
.authorizedGrantTypes("client_credentials", "refresh_token")
.scopes("server")
.and()
.withClient("geocoderRemote-service")
.secret("geocoderLocal-pwd")
.authorizedGrantTypes("client_credentials", "refresh_token")
.scopes("server")
.and()
.withClient("browser")
.authorizedGrantTypes("refresh_token", "password")
.scopes("ui")
.and();
}
示例8: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients)
throws Exception {
//@formatter:off
clients.inMemory()
.withClient("clientapp")
.secret("123456")
.authorizedGrantTypes(
"authorization_code",
"password",
"refresh_token")
.accessTokenValiditySeconds(120)
.refreshTokenValiditySeconds(3000)
.scopes("read_profile", "read_contacts");
//@formatter:on
}
示例9: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("normal-app")
.authorizedGrantTypes("authorization_code", "implicit")
.authorities("ROLE_CLIENT")
.scopes("read", "write")
.resourceIds(resourceId)
.accessTokenValiditySeconds(accessTokenValiditySeconds)
.and()
.withClient("trusted-app")
.authorizedGrantTypes("client_credentials", "password")
.authorities("ROLE_TRUSTED_CLIENT")
.scopes("read", "write")
.resourceIds(resourceId)
.accessTokenValiditySeconds(accessTokenValiditySeconds)
.secret("secret");
}
开发者ID:leftso,项目名称:demo-spring-boot-security-oauth2,代码行数:19,代码来源:AuthorizationServerConfiguration.java
示例10: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients)
throws Exception {
clients.inMemory()
.withClient("foo_app")
.autoApprove(true)
.authorities("FOO_READ", "FOO_WRITE")
.authorizedGrantTypes("authorization_code", "refresh_token", "implicit",
"password", "client_credentials")
.scopes("FOO")
.and()
.withClient("bar_app")
.autoApprove(true)
.authorities("BAR_READ", "BAR_WRITE")
.authorizedGrantTypes("authorization_code", "refresh_token", "implicit",
"password", "client_credentials")
.scopes("BAR");
}
示例11: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("normal-app")
.authorizedGrantTypes("authorization_code", "implicit")
.authorities("ROLE_CLIENT")
.scopes("read", "write")
.resourceIds(resourceId)
.accessTokenValiditySeconds(accessTokenValiditySeconds)
.and()
.withClient("trusted-app")
.authorizedGrantTypes("client_credentials", "password")
.authorities("ROLE_TRUSTED_CLIENT")
.scopes("read", "write")
.resourceIds(resourceId)
.accessTokenValiditySeconds(accessTokenValiditySeconds)
.secret("secret");
}
示例12: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.withClientDetails(clientDetailsService);
String client_key = System.getenv().get(TEST_CLIENT_KEY);
//Create Fake seldon deployment for testing
if (client_key != null)
{
String client_secret = System.getenv().get(TEST_CLIENT_SECRET);
clientDetailsService.addClient(client_key,client_secret);
SeldonDeployment dep = SeldonDeployment.newBuilder()
.setApiVersion("v1alpha1")
.setKind("SeldonDeplyment")
.setSpec(DeploymentSpec.newBuilder()
.setName("localhost")
.setOauthKey(client_key)
.setOauthSecret(client_secret)
).build();
deploymentStore.deploymentAdded(dep);
}
}
示例13: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
//@formatter:off
clients.inMemory()
.withClient(ReportPortalClient.ui.name())
.secret("uiman")
.authorizedGrantTypes("refresh_token", "password")
.scopes("ui")
.accessTokenValiditySeconds(sessionLive)
.and()
.withClient(ReportPortalClient.api.name())
.secret("apiman")
.authorizedGrantTypes("password")
.scopes("api")
.accessTokenValiditySeconds(-1)
.and()
.withClient(ReportPortalClient.internal.name())
.secret("internal_man")
.authorizedGrantTypes("client_credentials").authorities("ROLE_INTERNAL")
.scopes("internal");
//@formatter:on
}
示例14: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
/*
@TODO this should be done by a ClientDetailsService (similar to UserDetailsService) with an consumable resource
*/
clients.inMemory()
.withClient("web_app")
.scopes("openid")
.autoApprove(true)
.authorizedGrantTypes("implicit","refresh_token", "password", "authorization_code")
.and()
.withClient("internal")
.secret("internal") //only for testing!!! @TODO config or details service..
.autoApprove(true)
.authorizedGrantTypes("client_credentials");
}
示例15: configure
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; //导入依赖的package包/类
@Override
public void configure(final ClientDetailsServiceConfigurer clients) throws Exception {// @formatter:off
clients
// .jdbc(dataSource())
.inMemory().withClient("sampleClientId").authorizedGrantTypes("implicit")
.scopes("read", "write", "foo", "bar").autoApprove(false).accessTokenValiditySeconds(3600)
.and().withClient("fooClientIdPassword").secret("secret")
.authorizedGrantTypes("password", "authorization_code", "refresh_token").scopes("foo", "read", "write")
.accessTokenValiditySeconds(3600) // 1 hour
.refreshTokenValiditySeconds(2592000) // 30 days
.and().withClient("barClientIdPassword").secret("secret")
.authorizedGrantTypes("password", "authorization_code", "refresh_token").scopes("bar", "read", "write")
.accessTokenValiditySeconds(3600) // 1 hour
.refreshTokenValiditySeconds(2592000) // 30 days
;
}