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


Java ClientDetailsServiceConfigurer类代码示例

本文整理汇总了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");
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:18,代码来源:UaaConfiguration.java

示例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");
}
 
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:19,代码来源:OAuth2AuthorizationServer.java

示例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");
}
 
开发者ID:tinmegali,项目名称:Using-Spring-Oauth2-to-secure-REST,代码行数:24,代码来源:AuthorizationConfig.java

示例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);
}
 
开发者ID:jeesun,项目名称:spring-boot-oauth2-server,代码行数:17,代码来源:AuthServerOAuth2Config.java

示例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]));
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:OAuth2AuthorizationServerConfiguration.java

示例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();
}
 
开发者ID:ammiladi,项目名称:geocoder-microservices,代码行数:20,代码来源:AuthApplication.java

示例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
}
 
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:17,代码来源:OAuth2AuthorizationServer.java

示例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");
}
 
开发者ID:gdong42,项目名称:spring-auth-example,代码行数:19,代码来源:OAuth2Config.java

示例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");
}
 
开发者ID:TraineeSIIp,项目名称:PepSIIrup-2017,代码行数:19,代码来源:AuthorizationServerConfig.java

示例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);
    }
}
 
开发者ID:SeldonIO,项目名称:seldon-core,代码行数:23,代码来源:AuthorizationServerConfiguration.java

示例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
}
 
开发者ID:reportportal,项目名称:service-authorization,代码行数:25,代码来源:PrimarySecurityConfigs.java

示例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");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:17,代码来源:UaaConfiguration.java

示例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
		;
	}
 
开发者ID:Baeldung,项目名称:spring-security-oauth,代码行数:19,代码来源:OAuth2AuthorizationServerConfigInMemory.java


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