Skip to content

Commit 2bbb594

Browse files
nilo-msspetrescu84
andauthored
Native auth: Add support for claims request (#2496)
* add parametreized interface * Unit test for parameters * deprecated get access token * UserAccountResult tests * added tests for SignInAfter states * Objective C/SAmple app public * Update MSAL/src/native_auth/public/MSALNativeAuthPublicClientApplication.swift Co-authored-by: Danilo Raspa <[email protected]> * Update MSAL/src/native_auth/public/parameters/MSALNativeAuthGetAccessTokenParameters.swift Co-authored-by: Danilo Raspa <[email protected]> * Update MSAL/src/native_auth/public/parameters/MSALNativeAuthSignInAfterSignUpParameters.swift Co-authored-by: Danilo Raspa <[email protected]> * Update MSAL/src/native_auth/public/parameters/MSALNativeAuthSignInParameters.swift Co-authored-by: Danilo Raspa <[email protected]> * Update MSAL/src/native_auth/public/parameters/MSALNativeAuthSignUpParameters.swift Co-authored-by: Danilo Raspa <[email protected]> * Update MSAL/src/native_auth/public/parameters/MSALNativeAuthResetPasswordParameters.swift Co-authored-by: Danilo Raspa <[email protected]> * Update MSAL/src/native_auth/public/parameters/MSALNativeAuthSignInAfterResetPasswordParameters .swift Co-authored-by: Danilo Raspa <[email protected]> * Update MSAL/src/native_auth/public/parameters/MSALNativeAuthSignInParameters.swift Co-authored-by: Danilo Raspa <[email protected]> * Update MSAL/src/native_auth/public/MSALNativeAuthUserAccountResult.swift Co-authored-by: Danilo Raspa <[email protected]> * Update MSAL/src/native_auth/public/state_machine/state/SignInAfterResetPasswordState.swift Co-authored-by: Danilo Raspa <[email protected]> * PR Comments * PR Changes * Homogenized wording to flow * add claims request to the signIn parameters * Add claims request field to signIn method * fix compilation and add new unit tests, Fix integration test * update changelog file * fix indentation --------- Co-authored-by: Silviu Petrescu <[email protected]> Co-authored-by: Silviu Petrescu <[email protected]>
1 parent 7ae5bcf commit 2bbb594

File tree

32 files changed

+350
-164
lines changed

32 files changed

+350
-164
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## [1.7.0]
2-
* Move native auth public methods to parameter class
2+
* Add support for claims request in native authentication signIn (#2496)
3+
* Move native auth public methods to parameter class (#2492)
34

45
## [1.6.3]
56
* Merge 1.6.1-hotfix

MSAL/src/native_auth/controllers/MSALNativeAuthTokenController.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class MSALNativeAuthTokenController: MSALNativeAuthBaseController {
8181
oobCode: String? = nil,
8282
grantType: MSALNativeAuthGrantType,
8383
includeChallengeType: Bool = true,
84+
claimsRequestJson: String? = nil,
8485
context: MSALNativeAuthRequestContext) -> MSIDHttpRequest? {
8586
do {
8687
let params = MSALNativeAuthTokenRequestParameters(
@@ -92,7 +93,8 @@ class MSALNativeAuthTokenController: MSALNativeAuthBaseController {
9293
password: password,
9394
oobCode: oobCode,
9495
includeChallengeType: includeChallengeType,
95-
refreshToken: nil)
96+
refreshToken: nil,
97+
claimsRequestJson: claimsRequestJson)
9698
return try requestProvider.signInWithPassword(parameters: params, context: context)
9799
} catch {
98100
MSALLogger.log(level: .error, context: context, format: "Error creating SignIn Token Request: \(error)")
@@ -118,7 +120,8 @@ class MSALNativeAuthTokenController: MSALNativeAuthBaseController {
118120
password: nil,
119121
oobCode: nil,
120122
includeChallengeType: false,
121-
refreshToken: refreshToken)
123+
refreshToken: refreshToken,
124+
claimsRequestJson: nil)
122125
return try requestProvider.refreshToken(parameters: params, context: context)
123126
} catch {
124127
MSALLogger.log(level: .error, context: context, format: "Error creating Refresh Token Request: \(error)")

MSAL/src/native_auth/controllers/sign_in/MSALNativeAuthInternalSignInParameters.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@ class MSALNativeAuthInternalSignInParameters {
2929
let password: String?
3030
let context: MSALNativeAuthRequestContext
3131
let scopes: [String]?
32+
let claimsRequestJson: String?
3233

3334
init(
3435
username: String,
3536
password: String?,
3637
context: MSALNativeAuthRequestContext,
37-
scopes: [String]?) {
38+
scopes: [String]?,
39+
claimsRequestJson: String?) {
3840
self.username = username
3941
self.password = password
4042
self.context = context
4143
self.scopes = scopes
44+
self.claimsRequestJson = claimsRequestJson
4245
}
4346
}

MSAL/src/native_auth/controllers/sign_in/MSALNativeAuthMFAControlling.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,21 @@ protocol MSALNativeAuthMFAControlling {
3434
continuationToken: String,
3535
authMethod: MSALAuthMethod?,
3636
context: MSALNativeAuthRequestContext,
37-
scopes: [String]
37+
scopes: [String],
38+
claimsRequestJson: String?
3839
) async -> MFARequestChallengeControllerResponse
3940

4041
func getAuthMethods(
4142
continuationToken: String,
4243
context: MSALNativeAuthRequestContext,
43-
scopes: [String]
44+
scopes: [String],
45+
claimsRequestJson: String?
4446
) async -> MFAGetAuthMethodsControllerResponse
4547

4648
func submitChallenge(
4749
challenge: String,
4850
continuationToken: String,
4951
context: MSALNativeAuthRequestContext,
50-
scopes: [String]) async -> MFASubmitChallengeControllerResponse
52+
scopes: [String],
53+
claimsRequestJson: String?) async -> MFASubmitChallengeControllerResponse
5154
}

0 commit comments

Comments
 (0)