Skip to content

Commit

Permalink
merge in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
melissaahn committed Dec 12, 2023
2 parents 64555cc + 9a2bf96 commit a4dc267
Show file tree
Hide file tree
Showing 33 changed files with 6,322 additions and 43 deletions.
2 changes: 1 addition & 1 deletion common
Submodule common updated 126 files
15 changes: 11 additions & 4 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ext {
kotlinVersion = '1.7.21'
spotBugsGradlePluginVersion = '4.7.1'
jupiterApiVersion = '5.6.0'

//Java Language Support
coreLibraryDesugaringVersion = "1.1.5"

Expand Down Expand Up @@ -45,7 +45,6 @@ ext {
rulesVersion = "1.2.0"
robolectricVersion = "4.9.2"
uiAutomatorVersion = "2.2.0"
flatBuffersJavaVersion = "1.12.0"
daggerVersion = "2.31.2"
daggerCompilerVersion = "2.31.2"
msal4jVersion = "1.10.0"
Expand All @@ -62,14 +61,22 @@ ext {
junitVintageEngineVersion = "5.7.2"
dbusJavaVersion = "3.3.0"
dbusJavaUtilsVersion = "3.3.0"
bouncyCastleVersion = "1.69"
bouncyCastleVersion = "1.77"
oshiCoreVersion = "5.7.5"
tokenShare = "1.6.5"
intuneAppSdkVersion = "8.6.3"
javaAssistVersion = "3.27.0-GA"
yubikitAndroidVersion = "2.3.0"
yubikitPivVersion = "2.3.0"
powerliftAndroidVersion="1.0.3"
kotlinXCoroutinesVersion = "1.6.4"
mockkVersion = "1.11.0"
mockitoKotlinVersion = "4.1.0"
androidxAnnotationVersion = "1.4.0"
spotBugsAnnotationVersion = "4.3.0"
jcipAnnotationVersion = "1.0-1"
openTelemetryVersion = "1.18.0"
jetpackDataStoreVersion = "1.0.0"
lifecycleKtxVersion="2.5.1"

// microsoft-diagnostics-uploader app versions
Expand Down Expand Up @@ -99,4 +106,4 @@ ext {
mockitoLibraryVersion = "1.2"
dexMakerLibraryVersion = "1.2"
//#### The ABOVE are TSL version variables - END
}
}
23 changes: 16 additions & 7 deletions msal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ dependencies {

def mockito_version = 'latest.release'

implementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$rootProject.ext.kotlinVersion"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$rootProject.ext.kotlinVersion"
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$rootProject.ext.kotlinVersion"

implementation "androidx.appcompat:appcompat:$rootProject.ext.appCompatVersion"
implementation "androidx.browser:browser:$rootProject.ext.browserVersion"
Expand All @@ -208,8 +208,10 @@ dependencies {
}
implementation "cz.msebera.android:httpclient:$rootProject.ext.mseberaApacheHttpClientVersion"
implementation "androidx.constraintlayout:constraintlayout:$rootProject.ext.constraintLayoutVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.ext.kotlinXCoroutinesVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$rootProject.ext.kotlinXCoroutinesVersion"

compileOnly 'com.github.spotbugs:spotbugs-annotations:4.3.0'
compileOnly "com.github.spotbugs:spotbugs-annotations:$rootProject.ext.spotBugsAnnotationVersion"

compileOnly "org.projectlombok:lombok:$rootProject.ext.lombokVersion"
annotationProcessor "org.projectlombok:lombok:$rootProject.ext.lombokVersion"
Expand All @@ -220,12 +222,19 @@ dependencies {
//see: https://javadoc.io/static/org.mockito/mockito-core/3.6.28/org/mockito/Mockito.html#0.1
testImplementation "org.mockito:mockito-inline:$rootProject.ext.mockitoCoreVersion"
testImplementation ("org.robolectric:robolectric:$rootProject.ext.robolectricVersion")
testImplementation "androidx.test:core:$rootProject.ext.androidxTestCoreVersion"
testImplementation "androidx.test:core:$rootProject.ext.androidxTestCoreVersion"
testLocalImplementation project(':testutils')
testDistImplementation("com.microsoft.identity:testutils:0.0+") {
exclude module: 'common'
exclude group: 'com.microsoft.identity', module: 'LabApiUtilities'
}
testImplementation project(':testutils')
testImplementation("org.mockito.kotlin:mockito-kotlin:$rootProject.ext.mockitoKotlinVersion") {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib'
}

testImplementation "io.mockk:mockk:$rootProject.ext.mockkVersion"

// instrumentation test dependencies
androidTestImplementation "androidx.test.ext:junit:$rootProject.ext.androidxJunitVersion"
// Set this dependency to use JUnit 4 rules
Expand All @@ -246,8 +255,8 @@ dependencies {
String common4jVersion = project.hasProperty("distCommon4jVersion") ? project.distCommon4jVersion : "1.0.+"
testDistImplementation(testFixtures("com.microsoft.identity:common4j:${common4jVersion}"))

implementation platform("io.opentelemetry:opentelemetry-bom:1.18.0")
implementation('io.opentelemetry:opentelemetry-api:1.18.0')
implementation platform("io.opentelemetry:opentelemetry-bom:$rootProject.ext.openTelemetryVersion")
implementation "io.opentelemetry:opentelemetry-api:$rootProject.ext.openTelemetryVersion"
}

def configDir = new File(buildscript.sourceFile.parentFile.parentFile, 'config')
Expand Down
4 changes: 2 additions & 2 deletions msal/src/main/java/com/microsoft/identity/client/Account.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public String getTenantId() {
}

@NonNull
String getHomeAccountId() {
public String getHomeAccountId() {
return getId() + "." + mHomeTenantId;
}

Expand All @@ -138,7 +138,7 @@ void setEnvironment(@NonNull final String environment) {
}

@NonNull
String getEnvironment() {
public String getEnvironment() {
return mEnvironment;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
// THE SOFTWARE.
package com.microsoft.identity.client;

import androidx.annotation.NonNull;

import com.microsoft.identity.client.exception.MsalDeclinedScopeException;
import com.microsoft.identity.common.java.result.ILocalAuthenticationResult;
import com.microsoft.identity.common.logging.Logger;
Expand All @@ -35,11 +33,17 @@
import java.util.Locale;
import java.util.Set;

class AuthenticationResultAdapter {
import androidx.annotation.NonNull;

/**
* AuthenticationResultAdapter is an adapter class that converts results in the form of
* [ILocalAuthenticationResult] objects to [IAuthenticationResult] objects.
*/
public class AuthenticationResultAdapter {

private static final String TAG = AuthenticationResultAdapter.class.getName();

static IAuthenticationResult adapt(@NonNull final ILocalAuthenticationResult localAuthenticationResult) {
public static IAuthenticationResult adapt(@NonNull final ILocalAuthenticationResult localAuthenticationResult) {
final IAuthenticationResult authenticationResult = new AuthenticationResult(
localAuthenticationResult.getCacheRecordWithTenantProfileData(),
localAuthenticationResult.getCorrelationId()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package com.microsoft.identity.client

import com.microsoft.identity.client.exception.MsalClientException
import com.microsoft.identity.client.exception.MsalException
import com.microsoft.identity.client.statemachine.results.ResetPasswordStartResult
import com.microsoft.identity.client.statemachine.results.SignInResult
import com.microsoft.identity.client.statemachine.results.SignInUsingPasswordResult
import com.microsoft.identity.client.statemachine.results.SignUpResult
import com.microsoft.identity.client.statemachine.results.SignUpUsingPasswordResult
import com.microsoft.identity.client.statemachine.states.AccountResult

/**
* INativeAuthPublicClientApplication provides top level interface that is used by app developers
* to use Native Auth methods.
*/
interface INativeAuthPublicClientApplication : IPublicClientApplication {
/**
* Listener callback for asynchronous initialization of INativeAuthPublicClientApplication object.
*/
interface INativeAuthApplicationCreatedListener {
/**
* Called once an INativeAuthPublicClientApplication is successfully created.
*/
fun onCreated(application: INativeAuthPublicClientApplication)

/**
* Called once INativeAuthPublicClientApplication can't be created.
*/
fun onError(exception: MsalException)
}

/**
* Retrieve the current signed in account from cache; Kotlin coroutines variant.
*
* @return [com.microsoft.identity.client.statemachine.states.AccountResult] if there is a signed in account, null otherwise.
*/
suspend fun getCurrentAccount(): AccountResult?

/**
* Retrieve the current signed in account from cache; Kotlin coroutines variant.
*
* @return [com.microsoft.identity.client.statemachine.states.AccountResult] if there is a signed in account, null otherwise.
*/
fun getCurrentAccount(callback: NativeAuthPublicClientApplication.GetCurrentAccountCallback)

/**
* Sign in a user with a given username; Kotlin coroutines variant.
*
* @param username username of the account to sign in.
* @param scopes (Optional) scopes to request during the sign in.
* @return [com.microsoft.identity.client.statemachine.results.SignInResult] see detailed possible return state under the object.
* @throws [MsalException] if an account is already signed in.
*/
suspend fun signIn(username: String, scopes: List<String>? = null): SignInResult

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

/**
* Sign in the account using username and password; Kotlin coroutines variant.
*
* @param username username of the account to sign in.
* @param password password of the account to sign in.
* @param scopes (Optional) list of scopes to request.
* @return [com.microsoft.identity.client.statemachine.results.SignInUsingPasswordResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
suspend fun signInUsingPassword(username: String, password: CharArray, scopes: List<String>? = null): SignInUsingPasswordResult

/**
* Sign in the account using username and password; callback variant.
*
* @param username username of the account to sign in.
* @param password password of the account to sign in.
* @param scopes (Optional) list of scopes to request.
* @param callback [com.microsoft.identity.client.NativeAuthPublicClientApplication.SignInUsingPasswordCallback] to receive the result.
* @return [com.microsoft.identity.client.statemachine.results.SignInUsingPasswordResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
fun signInUsingPassword(username: String, password: CharArray, scopes: List<String>? = null, callback: NativeAuthPublicClientApplication.SignInUsingPasswordCallback)

/**
* Sign up the account starting from a username; Kotlin coroutines variant.
*
* @param username username of the account to sign up.
* @param attributes (Optional) user attributes to be used during account creation.
* @return [com.microsoft.identity.client.statemachine.results.SignUpResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
suspend fun signUp(username: String, attributes: UserAttributes? = null): SignUpResult

/**
* Sign up the account starting from a username; callback variant.
*
* @param username username of the account to sign up.
* @param attributes (Optional) user attributes to be used during account creation.
* @param callback [com.microsoft.identity.client.NativeAuthPublicClientApplication.SignUpCallback] to receive the result.
* @return [com.microsoft.identity.client.statemachine.results.SignUpResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
fun signUp(username: String, attributes: UserAttributes? = null, callback: NativeAuthPublicClientApplication.SignUpCallback)

/**
* Sign up the account using username and password. Kotlin coroutines variant.
*
* @param username username of the account to sign up.
* @param password password of the account to sign up.
* @param attributes (Optional) user attributes to be used during account creation
* @return [com.microsoft.identity.client.statemachine.results.SignUpUsingPasswordResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
suspend fun signUpUsingPassword(username: String, password: CharArray, attributes: UserAttributes? = null): SignUpUsingPasswordResult

/**
* Sign up the account using username and password; callback variant.
*
* @param username username of the account to sign up.
* @param password password of the account to sign up.
* @param attributes (Optional) user attributes to be used during account creation
* @param callback [com.microsoft.identity.client.NativeAuthPublicClientApplication.SignUpUsingPasswordCallback] to receive the result.
* @return [com.microsoft.identity.client.statemachine.results.SignUpUsingPasswordResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
fun signUpUsingPassword(username: String, password: CharArray, attributes: UserAttributes? = null, callback: NativeAuthPublicClientApplication.SignUpUsingPasswordCallback)

/**
* 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.client.statemachine.results.ResetPasswordStartResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
suspend fun resetPassword(username: String): 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.client.NativeAuthPublicClientApplication.ResetPasswordCallback] to receive the result.
* @return [com.microsoft.identity.client.statemachine.results.ResetPasswordStartResult] see detailed possible return state under the object.
* @throws MsalClientException if an account is already signed in.
*/
fun resetPassword(username: String, callback: NativeAuthPublicClientApplication.ResetPasswordCallback)
}
Loading

0 comments on commit a4dc267

Please sign in to comment.