Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Auth Boss + JWT (Auth0) + negroni middle-ware #65

Open
4cecoder opened this issue Nov 20, 2022 · 0 comments
Open

[FEATURE] Auth Boss + JWT (Auth0) + negroni middle-ware #65

4cecoder opened this issue Nov 20, 2022 · 0 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@4cecoder
Copy link
Collaborator

4cecoder commented Nov 20, 2022

build a simple auth system

add simple middle-ware (negroni) with secure encryption by jwt

authboss chat support

refactor this authboss example code

turn this into a function which takes a parameter of router

func AuthRoute (router *mux.Router){}
ab := authboss.New()

ab.Config.Storage.Server = myDatabaseImplementation
ab.Config.Storage.SessionState = mySessionImplementation
ab.Config.Storage.CookieState = myCookieImplementation

ab.Config.Paths.Mount = "/authboss"
ab.Config.Paths.RootURL = "https://www.example.com/"

// This is using the renderer from: github.com/volatiletech/authboss
ab.Config.Core.ViewRenderer = abrenderer.NewHTML("/auth", "ab_views")
// Probably want a MailRenderer here too.


// This instantiates and uses every default implementation
// in the Config.Core area that exist in the defaults package.
// Just a convenient helper if you don't want to do anything fancy.
 defaults.SetCore(&ab.Config, false, false)

if err := ab.Init(); err != nil {
    panic(err)
}

// Mount the router to a path (this should be the same as the Mount path above)
// mux in this example is a chi router, but it could be anything that can route to
// the Core.Router.
mux.Mount("/authboss", http.StripPrefix("/authboss", ab.Config.Core.Router))
@4cecoder 4cecoder changed the title [FEATURE] Auth Boss + JWT (Auth0) + negroni [FEATURE] Auth Boss + JWT (Auth0) + middle-ware negroni Nov 20, 2022
@4cecoder 4cecoder changed the title [FEATURE] Auth Boss + JWT (Auth0) + middle-ware negroni [FEATURE] Auth Boss + JWT (Auth0) + negroni middle-ware Nov 20, 2022
@4cecoder 4cecoder self-assigned this Nov 20, 2022
@4cecoder 4cecoder added bug Something isn't working enhancement New feature or request labels Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant