@@ -24,7 +24,7 @@ namespace Microsoft.Identity.Web
24
24
public static class WebAppServiceCollectionExtensions
25
25
{
26
26
#region
27
- [ Obsolete ( "Use AddSignIn" ) ]
27
+ [ Obsolete ( "This method has been deprecated, please use the AddSignIn() method instead. " ) ]
28
28
public static IServiceCollection AddMicrosoftIdentityPlatform (
29
29
this IServiceCollection services ,
30
30
IConfiguration configuration ,
@@ -40,7 +40,7 @@ public static IServiceCollection AddMicrosoftIdentityPlatform(
40
40
return services ;
41
41
}
42
42
43
- [ Obsolete ( "Use AddWebAppCallsProtectedWebApi" ) ]
43
+ [ Obsolete ( "This method has been deprecated, please use the AddWebAppCallsProtectedWebApi() method instead. " ) ]
44
44
public static IServiceCollection AddMsal ( this IServiceCollection services ,
45
45
IConfiguration configuration ,
46
46
IEnumerable < string > initialScopes ,
@@ -60,9 +60,9 @@ public static IServiceCollection AddMsal(this IServiceCollection services,
60
60
/// <param name="initialScopes">Initial scopes to request at sign-in</param>
61
61
/// <returns></returns>
62
62
public static IServiceCollection AddWebAppCallsProtectedWebApi (
63
- this IServiceCollection services ,
64
- IConfiguration configuration ,
65
- IEnumerable < string > initialScopes ,
63
+ this IServiceCollection services ,
64
+ IConfiguration configuration ,
65
+ IEnumerable < string > initialScopes ,
66
66
string configSectionName = "AzureAd" ,
67
67
string openIdConnectScheme = OpenIdConnectDefaults . AuthenticationScheme )
68
68
{
@@ -125,8 +125,8 @@ public static IServiceCollection AddWebAppCallsProtectedWebApi(
125
125
/// </param>
126
126
/// <returns></returns>
127
127
public static AuthenticationBuilder AddSignIn (
128
- this AuthenticationBuilder builder ,
129
- IConfiguration configuration ,
128
+ this AuthenticationBuilder builder ,
129
+ IConfiguration configuration ,
130
130
Action < OpenIdConnectOptions > configureOptions ,
131
131
bool subscribeToOpenIdConnectMiddlewareDiagnosticsEvents = false ) =>
132
132
builder . AddSignIn (
@@ -150,9 +150,9 @@ public static AuthenticationBuilder AddSignIn(
150
150
/// </param>
151
151
/// <returns></returns>
152
152
public static AuthenticationBuilder AddSignIn (
153
- this AuthenticationBuilder builder ,
154
- string configSectionName ,
155
- IConfiguration configuration ,
153
+ this AuthenticationBuilder builder ,
154
+ string configSectionName ,
155
+ IConfiguration configuration ,
156
156
Action < OpenIdConnectOptions > configureOptions ,
157
157
bool subscribeToOpenIdConnectMiddlewareDiagnosticsEvents = false ) =>
158
158
builder . AddSignIn (
@@ -202,13 +202,16 @@ public static AuthenticationBuilder AddSignIn(
202
202
203
203
if ( ! AuthorityHelpers . IsV2Authority ( options . Authority ) )
204
204
options . Authority += "/v2.0" ;
205
-
205
+
206
206
options . TokenValidationParameters . NameClaimType = "preferred_username" ;
207
207
208
- // If you want to restrict the users that can sign-in to several organizations
209
- // Set the tenant value in the appsettings.json file to 'organizations', and add the
210
- // issuers you want to accept to options.TokenValidationParameters.ValidIssuers collection
211
- options . TokenValidationParameters . IssuerValidator = AadIssuerValidator . GetIssuerValidator ( options . Authority ) . Validate ;
208
+ if ( options . TokenValidationParameters . IssuerValidator == null )
209
+ {
210
+ // If you want to restrict the users that can sign-in to several organizations
211
+ // Set the tenant value in the appsettings.json file to 'organizations', and add the
212
+ // issuers you want to accept to options.TokenValidationParameters.ValidIssuers collection
213
+ options . TokenValidationParameters . IssuerValidator = AadIssuerValidator . GetIssuerValidator ( options . Authority ) . Validate ;
214
+ }
212
215
213
216
// Avoids having users being presented the select account dialog when they are already signed-in
214
217
// for instance when going through incremental consent
0 commit comments