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

Commit 9ad2940

Browse files
committed
Merge branch 'AM-3581-social-login-v2' into issue-1140-twitter
2 parents 1c3c11f + a619e65 commit 9ad2940

File tree

78 files changed

+5284
-196
lines changed

Some content is hidden

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

78 files changed

+5284
-196
lines changed

api/src/main/java/com/stormpath/sdk/application/ApplicationOptions.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,14 @@ public interface ApplicationOptions<T> extends AccountStoreOptions<T> {
7979
* @since 1.0.0
8080
*/
8181
T withWebConfig();
82+
83+
/**
84+
* Ensures that when retrieving an Application, the Application's {@link Application#getSamlPolicy() samlPolicy}
85+
* is also retrieved in the same request. This enhances performance by leveraging a single request to retrieve multiple
86+
* related resources you know you will use.
87+
*
88+
* @return this instance for method chaining.
89+
* @since 1.3.0
90+
*/
91+
T withSamlPolicy();
8292
}

api/src/main/java/com/stormpath/sdk/phone/Phone.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public interface Phone extends Resource, Saveable, Deletable, Auditable {
5252

5353
/**
5454
* Sets the phone's name.
55-
* @param name he phone's name.
55+
* @param name the phone's name.
5656
*
5757
* @return this instance for method chaining.
5858
*/
@@ -67,7 +67,7 @@ public interface Phone extends Resource, Saveable, Deletable, Auditable {
6767

6868
/**
6969
* Sets the phone's description.
70-
* @param description he phone's description.
70+
* @param description the phone's description.
7171
*
7272
* @return this instance for method chaining.
7373
*/

api/src/main/java/com/stormpath/sdk/phone/Phones.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public static EqualsExpressionFactory verificationStatus() {
229229
* Phones.where(<b>Phones.createdAt()</b>.matches("[,2014-04-05T12:00:00]");
230230
* </pre>
231231
* The above example invokes the returned factory's <code>matches("[,2014-04-05T12:00:00]"))</code> method. This
232-
* produces a name-specific {@link Criterion} which is added to the criteria query (via the
232+
* produces a createdAt-specific {@link Criterion} which is added to the criteria query (via the
233233
* {@link #where(Criterion) where} method).
234234
* <pre>
235235
* For example, the following code is equivalent:
@@ -254,7 +254,7 @@ public static DateExpressionFactory createdAt(){
254254
* Phones.where(<b>Phones.modifiedAt()</b>.matches("[,2014-04-05T12:00:00]");
255255
* </pre>
256256
* The above example invokes the returned factory's <code>matches("[,2014-04-05T12:00:00]"))</code> method. This
257-
* produces a name-specific {@link Criterion} which is added to the criteria query (via the
257+
* produces a modifiedAt-specific {@link Criterion} which is added to the criteria query (via the
258258
* {@link #where(Criterion) where} method).
259259
* <pre>
260260
* For example, the following code is equivalent:
@@ -279,12 +279,12 @@ private static DateExpressionFactory newDateExpressionFactory(String propName) {
279279
}
280280

281281
/**
282-
* Creates a new {@link com.stormpath.sdk.phone.CreatePhoneRequestBuilder CreatePhoneRequestBuilder}
282+
* Creates a new {@link com.stormpath.sdk.phone.CreatePhoneRequestBuilder createPhoneRequestBuilder}
283283
* instance reflecting the specified {@link com.stormpath.sdk.phone.Phone} instance. The builder can be used to customize any
284284
* creation request options as necessary.
285285
*
286286
* @param phone the phone to create a new record for within Stormpath
287-
* @return a new {@link com.stormpath.sdk.phone.CreatePhoneRequestBuilder CreatePhoneRequestBuilder}
287+
* @return a new {@link com.stormpath.sdk.phone.CreatePhoneRequestBuilder createPhoneRequestBuilder}
288288
* instance reflecting the specified {@link com.stormpath.sdk.phone.Phone} instance.
289289
** @see com.stormpath.sdk.account.Account#createPhone(CreatePhoneRequest)
290290
*
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: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.stormpath.sdk.provider.social;
22

3-
import java.util.Set;
3+
import com.stormpath.sdk.provider.MappingRule;
44

55
/**
66
* A rule that indicates how a userInfo attribute from a Social Provider should populate one or more Stormpath Account field values. By
@@ -25,27 +25,6 @@
2525
*
2626
* @since 1.3.0
2727
*/
28-
public interface UserInfoMappingRule {
28+
public interface UserInfoMappingRule extends MappingRule {
2929

30-
/**
31-
* Returns the UserInfo attribute name for a Social Provider, that when encountered, should have its value applied
32-
* as Account field values.
33-
* When this name is encountered when processing UserInfo from a Social Provider, its associated value will be set
34-
* as the value for all Stormpath Account field names specified in the
35-
* {@link #getAccountAttributes() accountAttributes} collection.
36-
*
37-
* @return UserInfo attribute name, that when encountered, should have its value set on the
38-
* {@link #getAccountAttributes() specified} Account fields.
39-
*/
40-
String getName();
41-
42-
/**
43-
* Returns the Stormpath account fields that should be updated when encountering {@link #getName() named}
44-
* UserInfo attribute name. If discovered, that UserInfo attribute value will be set on all of the Stormpath account
45-
* fields named in this collection.
46-
*
47-
* @return the Stormpath account fields that should be updated when encountering {@link #getName() named}
48-
* UserInfo attribute name.
49-
*/
50-
Set<String> getAccountAttributes();
5130
}

api/src/main/java/com/stormpath/sdk/provider/social/UserInfoMappingRuleBuilder.java

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package com.stormpath.sdk.provider.social;
1717

18-
import java.util.Set;
18+
import com.stormpath.sdk.provider.MappingRuleBuilder;
1919

2020
/**
2121
* A Builder to construct {@link UserInfoMappingRule} resources.
@@ -30,42 +30,6 @@
3030
*
3131
* @since 1.3.0
3232
*/
33-
public interface UserInfoMappingRuleBuilder {
33+
public interface UserInfoMappingRuleBuilder extends MappingRuleBuilder {
3434

35-
/**
36-
* Sets the UserInfo attribute name, that when encountered, should have its value applied as Account field values.
37-
* When this name is encountered when processing UserInfo from a Social Provider, its associated value will be set as the
38-
* value for all Stormpath Account field names specified in the
39-
* {@link UserInfoMappingRule#getAccountAttributes() accountAttributes} collection.
40-
*
41-
* @param name the UserInfo attribute name that when encountered, should have its value applied as Account field values.
42-
*/
43-
UserInfoMappingRuleBuilder setName(String name);
44-
45-
/**
46-
* Sets the Stormpath account fields that should be updated when encountering {@link UserInfoMappingRule#getName() named}
47-
* field from the userInfo provided by the social provider. If discovered, that UserInfo attribute value will be set on
48-
* all of the Stormpath account fields named in this collection.
49-
*
50-
* @param accountAttributes the account fields that should be updated when there's a match with a field name in userInfo
51-
* provided by the social provider.
52-
*/
53-
UserInfoMappingRuleBuilder setAccountAttributes(String... accountAttributes);
54-
55-
/**
56-
* Sets the Stormpath account fields that should be updated when encountering {@link UserInfoMappingRule#getName() named}
57-
* field from the userInfo provided by the social provider. If discovered, that UserInfo attribute value will be set on
58-
* all of the Stormpath account fields named in this collection.
59-
*
60-
* @param accountAttributes the account fields that should be updated when there's a match with a field name in userInfo
61-
* provided by the social provider.
62-
*/
63-
UserInfoMappingRuleBuilder setAccountAttributes(Set<String> accountAttributes);
64-
65-
/**
66-
* Builds a new {@link UserInfoMappingRule} based on the current state of this builder.
67-
*
68-
* @return a new {@link UserInfoMappingRule} to be included in the {@link UserInfoMappingRules} for a Social Provider.
69-
*/
70-
UserInfoMappingRule build();
7135
}

api/src/main/java/com/stormpath/sdk/saml/AttributeStatementMappingRule.java

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package com.stormpath.sdk.saml;
1717

18-
import java.util.Set;
18+
import com.stormpath.sdk.provider.MappingRule;
1919

2020
/**
2121
* A rule that indicates how a SAML Attribute Statement should populate one or more Stormpath Account field values. By
@@ -40,18 +40,7 @@
4040
*
4141
* @since 1.0.RC8
4242
*/
43-
public interface AttributeStatementMappingRule {
44-
45-
/**
46-
* Returns the SAML Attribute name, that when encountered, should have its value applied as Account field values.
47-
* When this name is encountered when processing a SAML Attribute Statement, its associated value will be set as the
48-
* value for all Stormpath Account field names specified in the
49-
* {@link #getAccountAttributes() accountAttributes} collection.
50-
*
51-
* @return SAML Attribute name, that when encountered, should have its value set on the
52-
* {@link #getAccountAttributes() specified} Account fields.
53-
*/
54-
String getName();
43+
public interface AttributeStatementMappingRule extends MappingRule {
5544

5645
/**
5746
* Returns the format for the SAML Attribute identified by {@link #getName() getName()}.
@@ -60,13 +49,4 @@ public interface AttributeStatementMappingRule {
6049
*/
6150
String getNameFormat();
6251

63-
/**
64-
* Returns the Stormpath account fields that should be updated when encountering {@link #getName() named}
65-
* SAML Attribute name. If discovered, that SAML Attribute value will be set on all of the Stormpath account
66-
* fields named in this collection.
67-
*
68-
* @return the Stormpath account fields that should be updated when encountering {@link #getName() named}
69-
* SAML Attribute name.
70-
*/
71-
Set<String> getAccountAttributes();
7252
}

api/src/main/java/com/stormpath/sdk/saml/AttributeStatementMappingRuleBuilder.java

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package com.stormpath.sdk.saml;
1717

18-
import java.util.Set;
18+
import com.stormpath.sdk.provider.MappingRuleBuilder;
1919

2020
/**
2121
* A Builder to construct {@link AttributeStatementMappingRule} resources.
@@ -30,17 +30,7 @@
3030
*
3131
* @since 1.0.RC8
3232
*/
33-
public interface AttributeStatementMappingRuleBuilder {
34-
35-
/**
36-
* Sets the SAML Attribute name, that when encountered, should have its value applied as Account field values.
37-
* When this name is encountered when processing a SAML Attribute Statement, its associated value will be set as the
38-
* value for all Stormpath Account field names specified in the
39-
* {@link AttributeStatementMappingRule#getAccountAttributes() accountAttributes} collection.
40-
*
41-
* @param name the SAML Attribute name that when encountered, should have its value applied as Account field values.
42-
*/
43-
AttributeStatementMappingRuleBuilder setName(String name);
33+
public interface AttributeStatementMappingRuleBuilder extends MappingRuleBuilder {
4434

4535
/**
4636
* Sets the format for the SAML Attribute specified by {@link com.stormpath.sdk.saml.AttributeStatementMappingRule#getName() getName()}.
@@ -55,28 +45,4 @@ public interface AttributeStatementMappingRuleBuilder {
5545
*/
5646
AttributeStatementMappingRuleBuilder setNameFormat(String nameFormat);
5747

58-
/**
59-
* Sets the Stormpath account fields that should be updated when encountering {@link AttributeStatementMappingRule#getName() named}
60-
* SAML Attribute name. If discovered, that SAML Attribute value will be set on all of the Stormpath account
61-
* fields named in this collection.
62-
*
63-
* @param accountAttributes the account fields that should be updated when there's a match with SAML Attribute name.
64-
*/
65-
AttributeStatementMappingRuleBuilder setAccountAttributes(String... accountAttributes);
66-
67-
/**
68-
* Sets the Stormpath account fields that should be updated when encountering {@link AttributeStatementMappingRule#getName() named}
69-
* SAML Attribute name. If discovered, that SAML Attribute value will be set on all of the Stormpath account
70-
* fields named in this collection.
71-
*
72-
* @param accountAttributes the account fields that should be updated when there's a match with SAML Attribute name.
73-
*/
74-
AttributeStatementMappingRuleBuilder setAccountAttributes(Set<String> accountAttributes);
75-
76-
/**
77-
* Builds a new {@link AttributeStatementMappingRule} based on the current state of this builder.
78-
*
79-
* @return a new {@link AttributeStatementMappingRule} to be included in the {@link AttributeStatementMappingRules} for a Saml Provider.
80-
*/
81-
AttributeStatementMappingRule build();
8248
}

api/src/main/java/com/stormpath/sdk/saml/AttributeStatementMappingRules.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
*/
1616
package com.stormpath.sdk.saml;
1717

18+
import com.stormpath.sdk.resource.Deletable;
1819
import com.stormpath.sdk.resource.Resource;
20+
import com.stormpath.sdk.resource.Saveable;
1921

20-
import java.util.Collection;
2122
import java.util.Set;
2223

2324
/**
@@ -31,7 +32,7 @@
3132
*
3233
* @since 1.0.RC8
3334
*/
34-
public interface AttributeStatementMappingRules extends Resource, Set<AttributeStatementMappingRule> {
35+
public interface AttributeStatementMappingRules extends Resource, Set<AttributeStatementMappingRule>, Saveable, Deletable{
3536

3637
/**
3738
* Removes the {@link AttributeStatementMappingRule}(s) identified by {@code ruleNames}.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.stormpath.sdk.saml;
2+
3+
import com.stormpath.sdk.application.Application;
4+
import com.stormpath.sdk.resource.Resource;
5+
6+
import java.util.Date;
7+
8+
/**
9+
* An AuthnVerification represents the successful results of verifying the signature of a SAML AuthnRequest targeted
10+
* against a particular Stormpath {@link Application}.
11+
*
12+
* @since 1.3.0
13+
*/
14+
public interface AuthnVerification extends Resource {
15+
16+
/**
17+
* Returns the relay state provided with the original SAML AuthnRequest, if any was provided. Otherwise the default
18+
* relay state configured for the {@link Application}.
19+
*
20+
* @return the relay state associated with the SAML AuthnRequest.
21+
*/
22+
String getRelayState();
23+
24+
/**
25+
* Returns the {@link RegisteredSamlServiceProvider} associated with the entityId of the original AuthnRequest.
26+
*
27+
* @return the {@link RegisteredSamlServiceProvider} associated with the entityId of the original AuthnRequest.
28+
*/
29+
RegisteredSamlServiceProvider getServiceProvider();
30+
31+
32+
/**
33+
* Returns the request ID provided with the original SAML AuthnRequest.
34+
*
35+
* @return the request ID provided with the original SAML AuthnRequest.
36+
*/
37+
String getRequestId();
38+
39+
40+
/**
41+
* Returns the issue instant of the original SAML AuthnRequest.
42+
*
43+
* @return the issue instant of the original SAML AuthnRequest.
44+
*/
45+
Date getAuthnIssueInstant();
46+
}

0 commit comments

Comments
 (0)