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

Commit b1f9e22

Browse files
committed
Merge branch 'AM-3581-social-login-v2' into issue-1140-twitter
# Conflicts: # extensions/httpclient/src/test/groovy/com/stormpath/sdk/client/DirectoryIT.groovy
2 parents 9ad2940 + 2e02ea6 commit b1f9e22

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed
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+
}

extensions/httpclient/src/test/groovy/com/stormpath/sdk/client/DirectoryIT.groovy

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package com.stormpath.sdk.client
1717

1818
import com.stormpath.sdk.account.Account
1919
import com.stormpath.sdk.account.Accounts
20+
import com.stormpath.sdk.directory.AccountCreationPolicy
2021
import com.stormpath.sdk.directory.Directories
2122
import com.stormpath.sdk.directory.Directory
2223
import com.stormpath.sdk.directory.DirectoryOptions
@@ -43,7 +44,14 @@ import org.testng.annotations.Test
4344
import java.lang.reflect.Field
4445
import java.util.concurrent.TimeUnit
4546

46-
import static org.testng.Assert.*
47+
import static org.testng.Assert.assertNull
48+
import static org.testng.Assert.assertNotNull
49+
import static org.testng.Assert.assertEquals
50+
import static org.testng.Assert.assertNotEquals
51+
import static org.testng.Assert.assertNotSame
52+
import static org.testng.Assert.assertTrue
53+
import static org.testng.Assert.assertFalse
54+
import static org.testng.Assert.fail
4755

4856
/**
4957
*

0 commit comments

Comments
 (0)