當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。