當前位置: 首頁>>代碼示例>>Java>>正文


Java SocialProperties類代碼示例

本文整理匯總了Java中org.springframework.boot.autoconfigure.social.SocialProperties的典型用法代碼示例。如果您正苦於以下問題:Java SocialProperties類的具體用法?Java SocialProperties怎麽用?Java SocialProperties使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SocialProperties類屬於org.springframework.boot.autoconfigure.social包,在下文中一共展示了SocialProperties類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: create

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
@Override
public CredentialProvider create(final SocialProperties properties) {
    final OAuth2ConnectorProperties oauth2Properties = (OAuth2ConnectorProperties) properties;

    final String appId = oauth2Properties.getAppId();
    final String appSecret = oauth2Properties.getAppSecret();
    final String authorizationUrl = oauth2Properties.getAuthorizationUrl();
    final String authenticationUrl = oauth2Properties.getAuthenticationUrl();
    final String accessTokenUrl = oauth2Properties.getAccessTokenUrl();
    final boolean useParametersForClientCredentials = oauth2Properties.isUseParametersForClientCredentials();
    final TokenStrategy tokenStrategy = oauth2Properties.getTokenStrategy();
    final String scope = oauth2Properties.getScope();

    final OAuth2ServiceProvider<RestOperations> serviceProvider = new GenericOAuth2ServiceProvider(appId, appSecret, authorizationUrl,
        authenticationUrl, accessTokenUrl, useParametersForClientCredentials, tokenStrategy);

    final OAuth2ConnectionFactory<RestOperations> connectionFactory = new OAuth2ConnectionFactory<>("oauth2", serviceProvider, null);
    connectionFactory.setScope(scope);

    final OAuth2Applicator applicator = new OAuth2Applicator(properties);
    applicator.setAccessTokenProperty("accessToken");

    return new OAuth2CredentialProvider<>("oauth2", connectionFactory, applicator);
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:25,代碼來源:OAuth2CredentialProviderFactory.java

示例2: shouldApplyTokens

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
@Test
public void shouldApplyTokens() {
    final SocialProperties properties = new SocialProperties() {
    };
    properties.setAppId("appId");
    properties.setAppSecret("appSecret");

    final OAuth1Applicator applicator = new OAuth1Applicator(properties);
    applicator.setAccessTokenSecretProperty("accessTokenSecretProperty");
    applicator.setAccessTokenValueProperty("accessTokenValueProperty");
    applicator.setConsumerKeyProperty("consumerKeyProperty");
    applicator.setConsumerSecretProperty("consumerSecretProperty");

    final Connection connection = new Connection.Builder().build();

    final Connection result = applicator.applyTo(connection, new OAuthToken("tokenValue", "tokenSecret"));

    final Connection expected = new Connection.Builder()
        .putConfiguredProperty("accessTokenSecretProperty", "tokenSecret")
        .putConfiguredProperty("accessTokenValueProperty", "tokenValue")
        .putConfiguredProperty("consumerKeyProperty", "appId")
        .putConfiguredProperty("consumerSecretProperty", "appSecret").build();

    assertThat(result).isEqualToIgnoringGivenFields(expected, "lastUpdated");
    assertThat(result.getLastUpdated()).isPresent();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:27,代碼來源:OAuth1ApplicatorTest.java

示例3: shouldApplyAccessGrants

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
@Test
public void shouldApplyAccessGrants() {
    final SocialProperties properties = new SocialProperties() {
    };
    properties.setAppId("appId");
    properties.setAppSecret("appSecret");

    final OAuth2Applicator applicator = new OAuth2Applicator(properties);
    applicator.setAccessTokenProperty("accessTokenProperty");
    applicator.setClientIdProperty("clientIdProperty");
    applicator.setClientSecretProperty("clientSecretProperty");
    applicator.setRefreshTokenProperty("refreshTokenProperty");

    final Connection connection = new Connection.Builder().build();

    final Connection result = applicator.applyTo(connection,
        new AccessGrant("accessToken", "scope", "refreshToken", 1L));

    final Connection expected = new Connection.Builder().putConfiguredProperty("accessTokenProperty", "accessToken")
        .putConfiguredProperty("clientIdProperty", "appId")
        .putConfiguredProperty("clientSecretProperty", "appSecret")
        .putConfiguredProperty("refreshTokenProperty", "refreshToken").build();

    assertThat(result).isEqualToIgnoringGivenFields(expected, "lastUpdated");
    assertThat(result.getLastUpdated()).isPresent();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:27,代碼來源:OAuth2ApplicatorTest.java

示例4: create

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
@Override
public CredentialProvider create(final SocialProperties properties) {
    @SuppressWarnings("unchecked")
    final OAuth2ConnectionFactory<Object> connectionFactory = mock(OAuth2ConnectionFactory.class);
    when(connectionFactory.generateState()).thenReturn("test-state");

    properties.setAppId("appId");
    properties.setAppSecret("appSecret");

    final OAuth2Applicator applicator = new OAuth2Applicator(properties);
    applicator.setAccessTokenProperty("accessToken");
    applicator.setClientIdProperty("clientId");
    applicator.setClientSecretProperty("clientSecret");
    applicator.setRefreshTokenProperty("refreshToken");

    final CredentialProvider credentialProvider = new OAuth2CredentialProvider<>("test-provider", connectionFactory,
        applicator);

    @SuppressWarnings({ "unchecked", "rawtypes" })
    final Class<MultiValueMap<String, String>> additionalParametersType = (Class) MultiValueMap.class;
    final OAuth2Operations operations = spy(new OAuth2Template("testClientId", "testClientSecret",
        "https://test/oauth2/authorize", "https://test/oauth2/token"));
    doReturn(new AccessGrant("token")).when(operations).exchangeForAccess(Matchers.anyString(),
        Matchers.anyString(), Matchers.any(additionalParametersType));

    when(connectionFactory.getOAuthOperations()).thenReturn(operations);

    return credentialProvider;
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:30,代碼來源:TestCredentialProviderFactory.java

示例5: createCredentialProvider

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
static CredentialProvider createCredentialProvider(final SocialProperties properties) {
    final TwitterConnectionFactory twitter = new TwitterConnectionFactory(properties.getAppId(),
        properties.getAppSecret());
    final OAuth1Applicator applicator = new OAuth1Applicator(properties);
    applicator.setConsumerKeyProperty("consumerKey");
    applicator.setConsumerSecretProperty("consumerSecret");
    applicator.setAccessTokenSecretProperty("accessTokenSecret");
    applicator.setAccessTokenValueProperty("accessToken");

    return new OAuth1CredentialProvider<>("twitter", twitter, applicator);
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:12,代碼來源:TwitterCredentialProviderFactory.java

示例6: createConnectionFactory

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
static SalesforceConnectionFactory
    createConnectionFactory(final SocialProperties salesforceProperties) {
    final SalesforceConnectionFactory salesforce = new SalesforceConnectionFactory(salesforceProperties.getAppId(),
        salesforceProperties.getAppSecret());

    final OAuth2Template oAuthOperations = (OAuth2Template) salesforce.getOAuthOperations();

    // Salesforce requires OAuth client id and secret on the OAuth request
    oAuthOperations.setUseParametersForClientAuthentication(true);

    return salesforce;
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:13,代碼來源:SalesforceCredentialProviderFactory.java

示例7: SalesforceApplicator

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
public SalesforceApplicator(final SalesforceConnectionFactory salesforce,
    final SocialProperties socialProperties) {
    super(socialProperties);
    this.salesforce = salesforce;

    setClientIdProperty("clientId");
    setClientSecretProperty("clientSecret");
    setRefreshTokenProperty("refreshToken");
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:10,代碼來源:SalesforceConfiguration.java

示例8: create

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
@Override
public CredentialProvider create(final SocialProperties properties) {
    @SuppressWarnings("unchecked")
    final OAuth2ConnectionFactory<Object> connectionFactory = mock(OAuth2ConnectionFactory.class);
    when(connectionFactory.generateState()).thenReturn("test-state");

    properties.setAppId("appId");
    properties.setAppSecret("appSecret");

    final OAuth2Applicator applicator = new OAuth2Applicator(properties);
    applicator.setAccessTokenProperty("accessToken");
    applicator.setClientIdProperty("clientId");
    applicator.setClientSecretProperty("clientSecret");
    applicator.setRefreshTokenProperty("refreshToken");

    final CredentialProvider credentialProvider = new OAuth2CredentialProvider<>("test-provider", connectionFactory,
        applicator);

    final OAuth2Operations operations = spy(new OAuth2Template("testClientId", "testClientSecret",
        "https://test/oauth2/authorize", "https://test/oauth2/token"));
    doReturn(new AccessGrant("token")).when(operations).exchangeForAccess(Matchers.anyString(),
        Matchers.anyString(), Matchers.any(MultiValueMap.class));

    when(connectionFactory.getOAuthOperations()).thenReturn(operations);

    return credentialProvider;
}
 
開發者ID:syndesisio,項目名稱:syndesis-rest,代碼行數:28,代碼來源:TestCredentialProviderFactory.java

示例9: create

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
@Override
public CredentialProvider create(final SocialProperties properties) {
    return createCredentialProvider(properties);
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:5,代碼來源:TwitterCredentialProviderFactory.java

示例10: OAuth2Applicator

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
public OAuth2Applicator(final SocialProperties socialProperties) {
    this.socialProperties = socialProperties;
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:4,代碼來源:OAuth2Applicator.java

示例11: OAuth1Applicator

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
public OAuth1Applicator(final SocialProperties properties) {
    consumerKey = properties.getAppId();
    consumerSecret = properties.getAppSecret();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:5,代碼來源:OAuth1Applicator.java

示例12: createCredentialProvider

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
static CredentialProvider createCredentialProvider(final SocialProperties properties) {
    final SalesforceConnectionFactory connectionFactory = createConnectionFactory(properties);

    return new OAuth2CredentialProvider<>("salesforce", connectionFactory,
        new SalesforceApplicator(connectionFactory, properties));
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:7,代碼來源:SalesforceCredentialProviderFactory.java

示例13: TestCredentialProvider

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
public TestCredentialProvider(final SocialProperties properties) {
    this.properties = properties;
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:4,代碼來源:TestCredentialProviderFactory.java

示例14: getProperties

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
public SocialProperties getProperties() {
    return properties;
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:4,代碼來源:TestCredentialProviderFactory.java

示例15: create

import org.springframework.boot.autoconfigure.social.SocialProperties; //導入依賴的package包/類
@Override
public CredentialProvider create(final SocialProperties properties) {
    return new TestCredentialProvider(properties);
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:5,代碼來源:TestCredentialProviderFactory.java


注:本文中的org.springframework.boot.autoconfigure.social.SocialProperties類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。