File tree Expand file tree Collapse file tree 4 files changed +30
-35
lines changed
BlazorWebAppEntraBff/BlazorWebAppEntra
BlazorWebAppEntra/BlazorWebAppEntra Expand file tree Collapse file tree 4 files changed +30
-35
lines changed Original file line number Diff line number Diff line change 16
16
. AddAuthenticationStateSerialization ( options => options . SerializeAllClaims = true ) ;
17
17
18
18
builder . Services . AddAuthentication ( OpenIdConnectDefaults . AuthenticationScheme )
19
- . AddMicrosoftIdentityWebApp ( builder . Configuration . GetSection ( "AzureAd" ) )
19
+ . AddMicrosoftIdentityWebApp ( msIdentityOptions =>
20
+ {
21
+ msIdentityOptions . CallbackPath = "/signin-oidc" ;
22
+ msIdentityOptions . ClientId = "{CLIENT ID (BLAZOR APP)}" ;
23
+ msIdentityOptions . Domain = "{DIRECTORY NAME}.onmicrosoft.com" ;
24
+ msIdentityOptions . Instance = "https://login.microsoftonline.com/" ;
25
+ msIdentityOptions . ResponseType = "code" ;
26
+ msIdentityOptions . TenantId = "{TENANT ID}" ;
27
+ } )
20
28
. EnableTokenAcquisitionToCallDownstreamApi ( )
21
- . AddDownstreamApi ( "DownstreamApi" , builder . Configuration . GetSection ( "DownstreamApi" ) )
29
+ . AddDownstreamApi ( "DownstreamApi" , configOptions =>
30
+ {
31
+ configOptions . BaseUrl = "{BASE URL}" ;
32
+ configOptions . Scopes = [ "{APP ID URI}/Weather.Get" ] ;
33
+ } )
22
34
. AddInMemoryTokenCaches ( ) ;
23
35
24
36
builder . Services . AddAuthorization ( ) ;
Original file line number Diff line number Diff line change 1
1
{
2
- /*
3
- The following identity settings need to be configured
4
- before the project can be successfully executed.
5
- For more info see https://aka.ms/dotnet-template-ms-identity-platform
6
- */
7
- "AzureAd" : {
8
- "CallbackPath" : " /signin-oidc" ,
9
- "ClientId" : " {CLIENT ID}" ,
10
- "Domain" : " {TENANT DOMAIN}" ,
11
- "Instance" : " https://login.microsoftonline.com/" ,
12
- "ResponseType" : " code" ,
13
- "TenantId" : " {TENANT ID}"
14
- },
15
2
"Logging" : {
16
3
"LogLevel" : {
17
4
"Default" : " Information" ,
18
5
"Microsoft.AspNetCore" : " Warning"
19
6
}
20
7
},
21
- "AllowedHosts" : " *" ,
22
- "DownstreamApi" : {
23
- "BaseUrl" : " {BASE ADDRESS}" ,
24
- "Scopes" : [ " {APP ID URI}/{SCOPE NAME}" ]
25
- }
8
+ "AllowedHosts" : " *"
26
9
}
Original file line number Diff line number Diff line change 13
13
14
14
// Add services to the container.
15
15
builder . Services . AddAuthentication ( OpenIdConnectDefaults . AuthenticationScheme )
16
- . AddMicrosoftIdentityWebApp ( builder . Configuration . GetSection ( "AzureAd" ) )
16
+ . AddMicrosoftIdentityWebApp ( msIdentityOptions =>
17
+ {
18
+ msIdentityOptions . CallbackPath = "/signin-oidc" ;
19
+ msIdentityOptions . ClientId = "{CLIENT ID (BLAZOR APP)}" ;
20
+ msIdentityOptions . Domain = "{DIRECTORY NAME}.onmicrosoft.com" ;
21
+ msIdentityOptions . Instance = "https://login.microsoftonline.com/" ;
22
+ msIdentityOptions . ResponseType = "code" ;
23
+ msIdentityOptions . TenantId = "{TENANT ID}" ;
24
+ } )
17
25
. EnableTokenAcquisitionToCallDownstreamApi ( )
18
- . AddDownstreamApi ( "DownstreamApi" , builder . Configuration . GetSection ( "DownstreamApi" ) )
26
+ . AddDownstreamApi ( "DownstreamApi" , configOptions =>
27
+ {
28
+ configOptions . BaseUrl = "{BASE URL}" ;
29
+ configOptions . Scopes = [ "{APP ID URI}/Weather.Get" ] ;
30
+ } )
19
31
. AddInMemoryTokenCaches ( ) ;
20
32
21
33
builder . Services . AddOptions < OpenIdConnectOptions > ( OpenIdConnectDefaults . AuthenticationScheme ) . Configure ( oidcOptions =>
Original file line number Diff line number Diff line change 1
1
{
2
- "AzureAd" : {
3
- "CallbackPath" : " /signin-oidc" ,
4
- "ClientId" : " {CLIENT ID}" ,
5
- "Domain" : " {TENANT DOMAIN}" ,
6
- "Instance" : " https://login.microsoftonline.com/" ,
7
- "ResponseType" : " code" ,
8
- "TenantId" : " {TENANT ID}"
9
- },
10
2
"Logging" : {
11
3
"LogLevel" : {
12
4
"Default" : " Information" ,
13
5
"Microsoft.AspNetCore" : " Warning"
14
6
}
15
7
},
16
- "AllowedHosts" : " *" ,
17
- "DownstreamApi" : {
18
- "BaseUrl" : " {BASE ADDRESS}" ,
19
- "Scopes" : [ " {APP ID URI}/{SCOPE}" ]
20
- }
8
+ "AllowedHosts" : " *"
21
9
}
You can’t perform that action at this time.
0 commit comments