An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.9% on proxy.golang.org
Top 4.7% dependent repos on proxy.golang.org
Top 9.9% forks on proxy.golang.org

proxy.golang.org : github.com/posener/auth

ackage auth provides painless OAuth2 authentication for http handlers. After creating an Auth object, the `RedirectHandler` should be mounted to answer the cfg.OAuth2.RedirectURL http calls and the `Authenticate` method can be used to enforce authentication on http handlers. The `User` function can be used to get the logged in user in an authenticated http handler. See simple usage example in ./example/main.go. Authentication is done by wrapping an `http.Handler` that requires only signed in users with the `Authenticate` middleware method. Authorization is allowing only specific users to access an `http.Handler`. For example, allowing only john@gmail.com, or anyone that signed in using their @example.com. This can be done by inspecting the username using the `auth.User(ctx)` method, inside the authenticated `http.Handler`. For example, given a function `authorized` that checks if the signed-in user is authorized: - [x] Automatic redirects to OAuth2 flow (login screen) from authorized handlers when user is not authenticated. - [x] Redirect handler automatic redirects to the path that requested to the authentication. Such that if user visited /foo and was sent to the OAuth2 login. After successfull login it will return to /foo. - [x] Auth2 id_token is automatically stored in a Cookie. This allows users not to go through the authentication phase on every authenticated page, or on different sessions.

Registry - Source - Documentation - JSON - codemeta.json
purl: pkg:golang/github.com/posener/auth
Keywords: go , golang , google , google-api , http , middleware , oauth2
License: Apache-2.0
Latest release: about 4 years ago
First release: over 4 years ago
Namespace: github.com/posener
Dependent repositories: 1
Stars: 7 on GitHub
Forks: 3 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 4 days ago

    Loading...
    Readme
    Loading...