Skip to content

Commit

Permalink
commiting to merge with dev so my pipeline will run
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrymsft committed Feb 4, 2025
2 parents f5665f7 + 213efa4 commit 3ea1190
Show file tree
Hide file tree
Showing 30 changed files with 1,595 additions and 316 deletions.
7 changes: 7 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ MSAL Wiki : https://github.com/AzureAD/microsoft-authentication-library-for-andr

vNext
----------
- [MINOR] Change AndroidActivityInteractiveTokenCommandParameters to AndroidInteractiveTokenCommandParameters (#2247)
- [MINOR] Move native auth public methods to parameter class (#2245)
- [MINOR] Add support for claims requests for native auth sign in (#2246)

Version 5.9.0
----------
-[MINOR] Add suberror for network errors (#2218)
-[PATCH] Update common @19.0.0

Version 5.8.2
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
import com.microsoft.identity.client.IAccount;
import com.microsoft.identity.client.ITenantProfile;
import com.microsoft.identity.client.MultiTenantAccount;
import com.microsoft.identity.common.internal.msafederation.google.SignInWithGoogleApi;
import com.microsoft.identity.common.internal.msafederation.google.SignInWithGoogleCredential;
import com.microsoft.identity.common.internal.msafederation.google.SignInWithGoogleParameters;
import com.microsoft.identity.common.internal.platform.AndroidPlatformUtil;
import com.microsoft.identity.common.java.logging.DiagnosticContext;
import com.microsoft.identity.nativeauth.AuthMethod;
Expand All @@ -42,7 +45,7 @@
import com.microsoft.identity.client.claims.ClaimsRequest;
import com.microsoft.identity.client.claims.RequestedClaimAdditionalInformation;
import com.microsoft.identity.common.components.AndroidPlatformComponentsFactory;
import com.microsoft.identity.common.internal.commands.parameters.AndroidActivityInteractiveTokenCommandParameters;
import com.microsoft.identity.common.internal.commands.parameters.AndroidInteractiveTokenCommandParameters;
import com.microsoft.identity.common.internal.util.StringUtil;
import com.microsoft.identity.common.java.authorities.Authority;
import com.microsoft.identity.common.java.authorities.AzureActiveDirectoryAuthority;
Expand Down Expand Up @@ -166,7 +169,7 @@ public static InteractiveTokenCommandParameters createInteractiveTokenCommandPar
authority
));

final InteractiveTokenCommandParameters commandParameters = AndroidActivityInteractiveTokenCommandParameters
return AndroidInteractiveTokenCommandParameters
.builder()
.activity(parameters.getActivity())
.platformComponents(AndroidPlatformComponentsFactory.createFromActivity(
Expand Down Expand Up @@ -204,8 +207,6 @@ public static InteractiveTokenCommandParameters createInteractiveTokenCommandPar
.correlationId(parameters.getCorrelationId())
.preferredAuthMethod(parameters.getPreferredAuthMethod())
.build();

return commandParameters;
}

public static SilentTokenCommandParameters createSilentTokenCommandParameters(
Expand Down Expand Up @@ -539,14 +540,17 @@ public static SignInStartCommandParameters createSignInStartCommandParameters(
@NonNull final OAuth2TokenCache tokenCache,
@NonNull final String username,
@Nullable final char[] password,
final List<String> scopes) throws ClientException {
final List<String> scopes,
@Nullable final ClaimsRequest claimsRequest) throws ClientException {
final AbstractAuthenticationScheme authenticationScheme = AuthenticationSchemeFactory.createScheme(
AndroidPlatformComponentsFactory.createFromContext(configuration.getAppContext()),
null
);

final NativeAuthCIAMAuthority authority = ((NativeAuthCIAMAuthority) configuration.getDefaultAuthority());

final String claimsRequestJson = ClaimsRequest.getJsonStringFromClaimsRequest(claimsRequest);

final SignInStartCommandParameters commandParameters = SignInStartCommandParameters.builder()
.platformComponents(AndroidPlatformComponentsFactory.createFromContext(configuration.getAppContext()))
.applicationName(configuration.getAppContext().getPackageName())
Expand All @@ -565,6 +569,7 @@ public static SignInStartCommandParameters createSignInStartCommandParameters(
.authenticationScheme(authenticationScheme)
.clientId(configuration.getClientId())
.challengeType(configuration.getChallengeTypes())
.claimsRequestJson(claimsRequestJson)
.scopes(scopes)
// Start of the flow, so there is no correlation ID to use from a previous API response.
// Set it to a default value.
Expand Down Expand Up @@ -640,7 +645,8 @@ public static SignInSubmitCodeCommandParameters createSignInSubmitCodeCommandPar
@NonNull final String code,
@NonNull final String continuationToken,
@NonNull final String correlationId,
final List<String> scopes) throws ClientException {
final List<String> scopes,
@Nullable final String claimsRequestJson) throws ClientException {

final NativeAuthCIAMAuthority authority = ((NativeAuthCIAMAuthority) configuration.getDefaultAuthority());

Expand Down Expand Up @@ -668,6 +674,7 @@ public static SignInSubmitCodeCommandParameters createSignInSubmitCodeCommandPar
.code(code)
.scopes(scopes)
.correlationId(correlationId)
.claimsRequestJson(claimsRequestJson)
.build();

return commandParameters;
Expand Down Expand Up @@ -729,7 +736,8 @@ public static SignInSubmitPasswordCommandParameters createSignInSubmitPasswordCo
@NonNull final String continuationToken,
@NonNull final char[] password,
@NonNull final String correlationId,
final List<String> scopes) throws ClientException {
final List<String> scopes,
@Nullable final String claimsRequestJson) throws ClientException {

final NativeAuthCIAMAuthority authority = ((NativeAuthCIAMAuthority) configuration.getDefaultAuthority());

Expand Down Expand Up @@ -758,6 +766,7 @@ public static SignInSubmitPasswordCommandParameters createSignInSubmitPasswordCo
.scopes(scopes)
.challengeType(configuration.getChallengeTypes())
.correlationId(correlationId)
.claimsRequestJson(claimsRequestJson)
.build();

return commandParameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ package com.microsoft.identity.nativeauth
import com.microsoft.identity.client.IPublicClientApplication
import com.microsoft.identity.client.exception.MsalClientException
import com.microsoft.identity.client.exception.MsalException
import com.microsoft.identity.nativeauth.parameters.NativeAuthResetPasswordParameters
import com.microsoft.identity.nativeauth.parameters.NativeAuthSignInParameters
import com.microsoft.identity.nativeauth.parameters.NativeAuthSignUpParameters
import com.microsoft.identity.nativeauth.statemachine.results.GetAccountResult
import com.microsoft.identity.nativeauth.statemachine.results.ResetPasswordStartResult
import com.microsoft.identity.nativeauth.statemachine.results.SignInResult
Expand Down Expand Up @@ -74,20 +77,39 @@ interface INativeAuthPublicClientApplication : IPublicClientApplication {
* @return [com.microsoft.identity.nativeauth.statemachine.results.SignInResult] see detailed possible return state under the object.
* @throws [MsalException] if an account is already signed in.
*/
@Deprecated("This method is now deprecated. Use the method 'signIn(parameters:)' instead.")
suspend fun signIn(username: String, password: CharArray? = null, scopes: List<String>? = null): SignInResult

/**
* Sign in a user for a provided parameters; Kotlin coroutines variant.
*
* @param parameters parameters used for signIn operation.
* @return [com.microsoft.identity.nativeauth.statemachine.results.SignInResult] see detailed possible return state under the object.
* @throws [MsalException] if an account is already signed in.
*/
suspend fun signIn(parameters: NativeAuthSignInParameters): SignInResult

/**
* Sign in a user with a given username; callback variant.
*
* @param username username of the account to sign in.
* @param password (Optional) password of the account to sign in.
* @param scopes (Optional) scopes to request during the sign in.
* @param callback [com.microsoft.identity.nativeauth.NativeAuthPublicClientApplication.SignInCallback] to receive the result.
* @return [com.microsoft.identity.nativeauth.statemachine.results.SignInResult] see detailed possible return state under the object.
* @throws [MsalException] if an account is already signed in.
*/
@Deprecated("This method is now deprecated. Use the method 'signIn(parameters:, callback:)' instead.")
fun signIn(username: String, password: CharArray? = null, scopes: List<String>? = null, callback: NativeAuthPublicClientApplication.SignInCallback)

/**
* Sign in a user for a provided parameters; callback variant.
*
* @param parameters parameters used for signIn operation.
* @param callback [com.microsoft.identity.nativeauth.NativeAuthPublicClientApplication.SignInCallback] to receive the result.
* @throws [MsalException] if an account is already signed in.
*/
fun signIn(parameters: NativeAuthSignInParameters, callback: NativeAuthPublicClientApplication.SignInCallback)

/**
* Sign up the account starting from a username; Kotlin coroutines variant.
*
Expand All @@ -97,8 +119,18 @@ interface INativeAuthPublicClientApplication : IPublicClientApplication {
* @return [com.microsoft.identity.nativeauth.statemachine.results.SignUpResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
@Deprecated("This method is now deprecated. Use the method 'signUp(parameters:)' instead.")
suspend fun signUp(username: String, password: CharArray? = null, attributes: UserAttributes? = null): SignUpResult

/**
* Sign up the account for a provided parameters; Kotlin coroutines variant.
*
* @param parameters parameters used for signUp operation.
* @return [com.microsoft.identity.nativeauth.statemachine.results.SignUpResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
suspend fun signUp(parameters: NativeAuthSignUpParameters): SignUpResult

/**
* Sign up the account starting from a username; callback variant.
*
Expand All @@ -109,24 +141,53 @@ interface INativeAuthPublicClientApplication : IPublicClientApplication {
* @return [com.microsoft.identity.nativeauth.statemachine.results.SignUpResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
@Deprecated("This method is now deprecated. Use the method 'signUp(parameters:, callback:)' instead.")
fun signUp(username: String, password: CharArray? = null, attributes: UserAttributes? = null, callback: NativeAuthPublicClientApplication.SignUpCallback)

/**
* Sign up the account for a provided parameters; callback variant.
*
* @param parameters parameters used for signUp operation.
* @param callback [com.microsoft.identity.nativeauth.NativeAuthPublicClientApplication.SignUpCallback] to receive the result.
* @throws MsalClientException if an account is already signed in.
*/
fun signUp(parameters: NativeAuthSignUpParameters, callback: NativeAuthPublicClientApplication.SignUpCallback)

/**
* Reset password for the account starting from a username; Kotlin coroutines variant.
*
* @param username username of the account to reset password.
* @return [com.microsoft.identity.nativeauth.statemachine.results.ResetPasswordStartResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
@Deprecated("This method is now deprecated. Use the method 'resetPassword(parameters:)' instead.")
suspend fun resetPassword(username: String): ResetPasswordStartResult

/**
* Reset password for the account for a provided parameters; Kotlin coroutines variant.
*
* @param parameters parameters used for resetPassword operation.
* @return [com.microsoft.identity.nativeauth.statemachine.results.ResetPasswordStartResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
suspend fun resetPassword(parameters: NativeAuthResetPasswordParameters): ResetPasswordStartResult

/**
* Reset password for the account starting from a username; callback variant.
*
* @param username username of the account to reset password.
* @param callback [com.microsoft.identity.nativeauth.NativeAuthPublicClientApplication.ResetPasswordCallback] to receive the result.
* @return [com.microsoft.identity.nativeauth.statemachine.results.ResetPasswordStartResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
@Deprecated("This method is now deprecated. Use the method 'resetPassword(parameters:, callback:)' instead.")
fun resetPassword(username: String, callback: NativeAuthPublicClientApplication.ResetPasswordCallback)

/**
* Reset password for the account for a provided parameters; callback variant.
*
* @param parameters parameters used for resetPassword operation.
* @param callback [com.microsoft.identity.nativeauth.NativeAuthPublicClientApplication.ResetPasswordCallback] to receive the result.
* @throws MsalClientException if an account is already signed in.
*/
fun resetPassword(parameters: NativeAuthResetPasswordParameters, callback: NativeAuthPublicClientApplication.ResetPasswordCallback)
}
Loading

0 comments on commit 3ea1190

Please sign in to comment.