Skip to content
This repository was archived by the owner on Dec 12, 2018. It is now read-only.

Commit cd3fb8c

Browse files
author
Mario
committed
Merge branch '1.3.x' of github.com:stormpath/stormpath-sdk-java into 1158_handlers_fix_using_spring_security_in_front_stormpath
2 parents 3eaf48d + f14593c commit cd3fb8c

File tree

59 files changed

+1568
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1568
-118
lines changed

api/src/main/java/com/stormpath/sdk/provider/CreateProviderRequestBuilder.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package com.stormpath.sdk.provider;
1717

18+
import com.stormpath.sdk.provider.social.UserInfoMappingRules;
19+
1820
/**
1921
* A Builder to construct {@link CreateProviderRequest}s.
2022
*
@@ -41,6 +43,17 @@ public interface CreateProviderRequestBuilder<T extends CreateProviderRequestBui
4143
*/
4244
T setClientSecret(String clientSecret);
4345

46+
/**
47+
* set rules for mapping fields from userInfo provided by the social provider to Stormpath Account attributes
48+
* for Accounts created in the associated Stormpath Directory.
49+
*
50+
* @param userInfoMappingRules rules for mapping fields from userInfo provided by the social provider to Stormpath
51+
* Account attributes.
52+
* @return the current builder instance for method chaining.
53+
* @since 1.3.0
54+
*/
55+
T setUserInfoMappingRules(UserInfoMappingRules userInfoMappingRules);
56+
4457
/**
4558
* Creates a new {@code CreateProviderRequest} instance based on the current builder state.
4659
*

api/src/main/java/com/stormpath/sdk/provider/FacebookProviderData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
public interface FacebookProviderData extends ProviderData {
2424

2525
/**
26-
* Getter for the Facebook authorization code.
26+
* Getter for the Facebook access token.
2727
*
28-
* @return the Facebook authorization code.
28+
* @return the Facebook access token.
2929
*/
3030
String getAccessToken();
3131

api/src/main/java/com/stormpath/sdk/provider/GithubProviderData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
public interface GithubProviderData extends ProviderData {
2424

2525
/**
26-
* Getter for the Github authorization code.
26+
* Getter for the Github access token.
2727
*
28-
* @return the Github authorization code.
28+
* @return the Github access token.
2929
*/
3030
String getAccessToken();
3131

api/src/main/java/com/stormpath/sdk/provider/LinkedInProviderData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
public interface LinkedInProviderData extends ProviderData {
2424

2525
/**
26-
* Getter for the LinkedIn authorization code.
26+
* Getter for the LinkedIn access token.
2727
*
28-
* @return the LinkedIn authorization code.
28+
* @return the LinkedIn access token.
2929
*/
3030
String getAccessToken();
3131

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.stormpath.sdk.provider;
2+
3+
import java.util.Set;
4+
5+
/**
6+
* @since 1.3.0
7+
*/
8+
public interface MappingRule {
9+
10+
/**
11+
* Returns the attribute name for a Social Provider or SAML Provider, that when encountered, should have its value
12+
* applied as Account field values.
13+
* When this name is encountered when processing UserInfo from a Social Provider or SAML Attribute Statement,
14+
* its associated value will be set as the value for all Stormpath Account field names specified in the
15+
* {@link #getAccountAttributes() accountAttributes} collection.
16+
*
17+
* @return attribute name, that when encountered, should have its value set on the
18+
* {@link #getAccountAttributes() specified} Account fields.
19+
*/
20+
String getName();
21+
22+
/**
23+
* Returns the Stormpath account fields that should be updated when encountering {@link #getName() named}
24+
* attribute name. If discovered, that attribute value will be set on all of the Stormpath account
25+
* fields named in this collection.
26+
*
27+
* @return the Stormpath account fields that should be updated when encountering {@link #getName() named}
28+
* attribute name.
29+
*/
30+
Set<String> getAccountAttributes();
31+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.stormpath.sdk.provider;
2+
3+
import com.stormpath.sdk.provider.social.UserInfoMappingRules;
4+
import com.stormpath.sdk.saml.SamlAttributeStatementMappingRules;
5+
6+
import java.util.Set;
7+
8+
/**
9+
* @since 1.3.0
10+
*/
11+
public interface MappingRuleBuilder {
12+
13+
/**
14+
* Sets the attribute name, that when encountered, should have its value applied as Account field values.
15+
* When this name is encountered when processing UserInfo from a Social Provider or SAML Attribute Statement,
16+
* its associated value will be set as the value for all Stormpath Account field names specified in the
17+
* {@link MappingRule#getAccountAttributes() accountAttributes} collection.
18+
*
19+
* @param name the attribute name that when encountered, should have its value applied as Account field values.
20+
*/
21+
MappingRuleBuilder setName(String name);
22+
23+
/**
24+
* Sets the Stormpath account fields that should be updated when encountering {@link MappingRule#getName() named}
25+
* field from the userInfo provided by the social provider or SAML Attribute Statement.
26+
* If discovered, that attribute value will be set on
27+
* all of the Stormpath account fields named in this collection.
28+
*
29+
* @param accountAttributes the account fields that should be updated when there's a match with a field name in userInfo
30+
* provided by the social provider or SAML Attribute Statement.
31+
*/
32+
MappingRuleBuilder setAccountAttributes(String... accountAttributes);
33+
34+
/**
35+
* Sets the Stormpath account fields that should be updated when encountering {@link MappingRule#getName() named}
36+
* field from the userInfo provided by the social provider. If discovered, that attribute value will be set on
37+
* all of the Stormpath account fields named in this collection.
38+
*
39+
* @param accountAttributes the account fields that should be updated when there's a match with a field name in userInfo
40+
* provided by the social provider or SAML Attribute Statement.
41+
*/
42+
MappingRuleBuilder setAccountAttributes(Set<String> accountAttributes);
43+
44+
/**
45+
* Builds a new {@link MappingRule} based on the current state of this builder.
46+
*
47+
* @return a new {@link MappingRule} to be included in the {@link UserInfoMappingRules} for a Social Provider or
48+
* the {@link SamlAttributeStatementMappingRules} SAML Provider.
49+
*/
50+
MappingRule build();
51+
}

api/src/main/java/com/stormpath/sdk/provider/OAuthProvider.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package com.stormpath.sdk.provider;
1717

18+
import com.stormpath.sdk.provider.social.UserInfoMappingRules;
19+
1820
import java.util.List;
1921

2022
/**
@@ -42,4 +44,11 @@ public interface OAuthProvider extends Provider {
4244
* @since 1.2.0
4345
*/
4446
List<String> getScope();
47+
48+
/**
49+
* Returns the userInfoMappingRules configured for the oauth provider
50+
* @return the userInfoMappingRules configured for the oauth provider
51+
* @since 1.3.0
52+
*/
53+
UserInfoMappingRules getUserInfoMappingRules();
4554
}

api/src/main/java/com/stormpath/sdk/provider/Providers.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,14 @@ private Providers() {
8484
* @since 1.0.RC8
8585
*/
8686
public static final SamlRequestFactory SAML = (SamlRequestFactory) Classes.newInstance("com.stormpath.sdk.impl.provider.saml.DefaultSamlRequestFactory");
87+
88+
/**
89+
* Returns a new {@link TwitterRequestFactory} instance, used to construct Twitter requests, like Twitter Account creation and retrieval.
90+
*
91+
* @return a new {@link TwitterRequestFactory} instance, used to construct Twitter requests, like Twitter Account creation and retrieval.
92+
* @since 1.3.0
93+
*/
94+
public static final TwitterRequestFactory TWITTER = (TwitterRequestFactory) Classes.newInstance("com.stormpath.sdk.impl.provider.DefaultTwitterRequestFactory");
95+
8796
}
8897

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.stormpath.sdk.provider;
2+
3+
/**
4+
* Twitter's specific {@link ProviderAccountRequestBuilder} interface.
5+
*
6+
* @since 1.3.0
7+
*/
8+
public interface TwitterAccountRequestBuilder extends ProviderAccountRequestBuilder<TwitterAccountRequestBuilder> {
9+
10+
/**
11+
* Setter for the Provider App access token.
12+
*
13+
* @param accessToken the Provider App access token.
14+
* @return the builder instance for method chaining.
15+
*/
16+
TwitterAccountRequestBuilder setAccessTokenSecret(String accessToken);
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.stormpath.sdk.provider;
2+
3+
/**
4+
* Twitter's specific {@link CreateProviderRequestBuilder} interface.
5+
*
6+
* @since 1.3.0
7+
*/
8+
public interface TwitterCreateProviderRequestBuilder extends CreateProviderRequestBuilder<TwitterCreateProviderRequestBuilder> {
9+
10+
}

0 commit comments

Comments
 (0)