
com.stormpath.sdk.provider.social.UserInfoMappingRule Maven / Gradle / Ivy
Show all versions of stormpath-sdk-api Show documentation
package com.stormpath.sdk.provider.social;
import com.stormpath.sdk.provider.MappingRule;
/**
* A rule that indicates how a userInfo attribute from a Social Provider should populate one or more Stormpath Account field values. By
* creating rules, you configure which userInfo attribute values from the Social Provider should be copied to Stormpath Account field values.
* {@code UserInfoMappingRule}s are immutable. If you want to change the mapping rules for Accounts in a
* particular Social Directory, you must remove and add new {@code UserInfoMappingRule} instances to the
* Directory Provider's {@link UserInfoMappingRules} instance.
*
*
How does it work?
* Each {@code UserInfoMappingRule} has a {@code name} and a collection of Stormpath account
* {@link #getAccountAttributes() attribute names}.
* When a userInfo attribute from a Social Provider is encountered, every userInfo attribute from the Social Provider
* with a matching name will have its value copied to the corresponding specified Stormpath account fields.
*
* Example
* For example, assume that a mapping rule's {@code name} is {@code foo}, and the rule's
* {@link #getAccountAttributes() accountAttributes} collection contains the Stormpath Account field names
* of {@code givenName} and {@code surname}.
* If a userInfo attribute named {@code foo} is encountered on login to have a value of {@code bar}, then
* {@code bar} will automatically be copied to the specified Stormpath Account fields for that user. This user would
* then automatically have a {@code givenName} of {@code bar} and a {@code surname} of {@code bar}.
*
* @since 1.3.0
*/
public interface UserInfoMappingRule extends MappingRule {
}