|
| 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 | +} |
0 commit comments