File tree Expand file tree Collapse file tree
common/src/main/java/com/microsoft/identity/common/internal/providers/oauth2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323package com.microsoft.identity.common.internal.providers.oauth2
2424
2525import android.content.Intent
26+ import android.os.Bundle
2627import androidx.fragment.app.Fragment
2728import com.microsoft.identity.common.adal.internal.AuthenticationConstants
2829import com.microsoft.identity.common.internal.msafederation.getIdProviderExtraQueryParamForAuthorization
@@ -227,4 +228,26 @@ object AuthorizationActivityFactory {
227228 )
228229 return getAuthorizationActivityIntent(newAuthorizationActivityParameters)
229230 }
231+
232+ /* *
233+ * OnaAuth method
234+ * Returns the correct authorization fragment for local (non-broker) authorization flows,
235+ * supplying a start bundle for the Fragment state.
236+ * Fragments include:
237+ * [WebViewAuthorizationFragment]
238+ * [BrowserAuthorizationFragment]
239+ * [CurrentTaskBrowserAuthorizationFragment]
240+ *
241+ * @param intent the intent to use to create the fragment.
242+ * @param bundle the bundle to add to the Fragment if it is an AuthorizationFragment.
243+ * @return returns an Fragment that's used as to authorize a token request.
244+ */
245+ @JvmStatic
246+ fun getAuthorizationFragmentFromStartIntentWithState (intent : Intent , bundle : Bundle ): Fragment {
247+ val fragment = getAuthorizationFragmentFromStartIntent(intent)
248+ if (fragment is AuthorizationFragment ) {
249+ fragment.setInstanceState(bundle)
250+ }
251+ return fragment
252+ }
230253}
You can’t perform that action at this time.
0 commit comments