Skip to content

A simple Blazor WebAssembly use AddOidcAuthentication() to call secured WebApis

License

Notifications You must be signed in to change notification settings

OurAuth/Blazor320WasmHostedPwaOidc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blazor320WasmHostedPwaOidc

A simple Blazor WebAssembly use AddOidcAuthentication() to call secured WebApis

0.Oidc Server (eg. IdentityServer4)

1.Client (ie. this repo)

ClientId = "OurAuth.Demo.Oidc.Local",
ClientName = "OurAuth Demo Oidc (Local/Development)",
ClientUri = "https://localhost:5001",

AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
RequireClientSecret = false,

RedirectUris = { "https://localhost:5001/authentication/login-callback" },
PostLogoutRedirectUris = { "https://localhost:5001/authentication/logout-callback" },
AllowedCorsOrigins = { "https://localhost:5001" },

AllowedScopes = {
    IdentityServerConstants.StandardScopes.OpenId,
    IdentityServerConstants.StandardScopes.Profile,
    IdentityServerConstants.StandardScopes.Email,
    IdentityServerConstants.StandardScopes.Phone,
    "ourauth.mgrapi",
    "ourauth.demoapi"
}

2.1 DemoApi

Name = "ourauth.demoapi";
DisplayName = "OurAuth DemoApi";

Scopes = new[]
{
    new Scope()
    {
        Name = "ourauth.demoapi",
        DisplayName = "Common access to OurAuth DemoAPI"
    }
};

UserClaims = new[]
{
    JwtClaimTypes.Subject,
    JwtClaimTypes.Name,
    JwtClaimTypes.PreferredUserName,
    JwtClaimTypes.NickName,
    JwtClaimTypes.Profile,
    JwtClaimTypes.IdentityProvider,
    JwtClaimTypes.Role
};

2.2 MgrApi

https://localhost:6003/api/ApiResources [Authorize]

Name = "ourauth.mgrapi";
DisplayName = "OurAuth ManagementApi";

Scopes = new[]
{
    new Scope()
    {
        Name = "ourauth.mgrapi",
        DisplayName = "Full access to OurAuth ManagementAPI"
    }
};

UserClaims = new[]
{
    JwtClaimTypes.Subject,
    JwtClaimTypes.Role
};

About

A simple Blazor WebAssembly use AddOidcAuthentication() to call secured WebApis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published