@@ -54,6 +54,11 @@ public final class Auth {
5454 */
5555 private final String identityProvider ;
5656
57+ /**
58+ * Idp indentifier for provider mapping
59+ */
60+ private final String idpIdentifier ;
61+
5762 /**
5863 * This identifies the settings for additional userPool features.
5964 */
@@ -137,7 +142,8 @@ private Auth(final Context context,
137142 final Set <String > scopes ,
138143 final AuthHandler userHandler ,
139144 final boolean advancedSecurityDataCollectionFlag ,
140- final String identityProvider ) {
145+ final String identityProvider ,
146+ final String idpIdentifier ) {
141147 this .context = context ;
142148 this .appWebDomain = appWebDomain ;
143149 this .appId = appId ;
@@ -151,6 +157,7 @@ private Auth(final Context context,
151157 this .userPoolId = userPoolId ;
152158 this .advancedSecurityDataCollectionFlag = advancedSecurityDataCollectionFlag ;
153159 this .identityProvider = identityProvider ;
160+ this .idpIdentifier = idpIdentifier ;
154161 getCurrentUser ();
155162 }
156163
@@ -210,6 +217,11 @@ public static final class Builder {
210217 */
211218 private String mIdentityProvider ;
212219
220+ /**
221+ * Idp identifier for the userPool.
222+ */
223+ private String mIdpIdentifier ;
224+
213225 /**
214226 * Flag indicating if data collection for advanced security mode is enabled.
215227 * By default this is enabled.
@@ -373,6 +385,20 @@ public Builder setIdentityProvider(final String mIdentityProvider) {
373385 return this ;
374386 }
375387
388+ /**
389+ * Sets the idp identifier. This will change the hosted UI behavior to go directly to the corresponding provider
390+ * <p>
391+ * Optional. Set idp identifier for provider mapping.
392+ * </p>
393+ * @param mIdpIdentifier Required: Scopes as a {@link Set<String>}.
394+ * @return A reference to this builder.
395+ */
396+ @ SuppressWarnings ("checkstyle:hiddenfield" )
397+ public Builder setIdpIdentifier (final String mIdpIdentifier ) {
398+ this .mIdpIdentifier = mIdpIdentifier ;
399+ return this ;
400+ }
401+
376402 /**
377403 * Instantiates {@link Auth} with the set options.
378404 * @return {@link Auth}.
@@ -389,7 +415,8 @@ public Auth build() {
389415 this .mScopes ,
390416 this .mUserHandler ,
391417 this .mAdvancedSecurityDataCollectionFlag ,
392- this .mIdentityProvider );
418+ this .mIdentityProvider ,
419+ this .mIdpIdentifier );
393420 }
394421
395422
@@ -524,6 +551,13 @@ public String getIdentityProvider() {
524551 return identityProvider ;
525552 }
526553
554+ /**
555+ * @return Identity Provider set for this {@link Auth} instance.
556+ */
557+ public String getIdpIdentifier () {
558+ return idpIdentifier ;
559+ }
560+
527561 /**
528562 * Use this method to get tokens for a user, the tokens are returned though the callback.
529563 * {@link AuthHandler#onSuccess(AuthUserSession)}.
0 commit comments