/authorization-auth0

Primary LanguageC#GNU General Public License v3.0GPL-3.0

Authorization.Auth0

Build Status

How to Use

Configuration

Property Name Description
Authority Auth0 authority
Audience Auth0 audience
Permissions A list of permissions to add to the token

Add Configuration

{
    "Haplo.Authorization.Auth" : {
        "Authority": "https://tenantname.au.auth0.com/",
        "Audience" : "https://servicename.domain.com/",
        "Permissions" : [
            "read:servicename",
            "delete:servicename",
            "create:servicename"
        ]
    }
}

Add Auth0

public void ConfigureServices(IServiceCollection services)
{
    ...
    var auth0Options = Configuration.GetAuth0Configuration()
    services.AddAuth0(auth0Options); 
    ...
}

Use Auth0

public void Configure(IServiceCollection services)
{
    ...
    app.UseAuth0() 
    ...
}

Development

Build, Package & Release

Locally

// Step 1: Authenticate
dotnet build --configuration release 

// Step 2: Pack
dotnet pack --configuration release 

// Step 3: Publish
dotnet nuget push "Haplo.Authorization.Auth0.nupkg" -Source "github"

Jenkins Blueocean Pipelines

Create GitHub organisation and scan all repos, the Jenkins file should be picked up automatically.

Reading Material

On The Nature of OAuth2’s Scopes