Skip to content

Commit 27814c1

Browse files
authored
Restore getAuthorizationFragmentFromStartIntentWithState (#2611)
Removed this method on this PR #2557 and this broke OneAuth, this is used there https://office.visualstudio.com/OneAuth/_git/OneAuth?path=/msal/source/android/msal/app/src/main/java/com/microsoft/identity/internal/ui/BrowserContainerDialog.java
1 parent ddd25d1 commit 27814c1

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

common/src/main/java/com/microsoft/identity/common/internal/providers/oauth2/AuthorizationActivityFactory.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
package com.microsoft.identity.common.internal.providers.oauth2
2424

2525
import android.content.Intent
26+
import android.os.Bundle
2627
import androidx.fragment.app.Fragment
2728
import com.microsoft.identity.common.adal.internal.AuthenticationConstants
2829
import 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
}

0 commit comments

Comments
 (0)