Categorygithub.com/dozen/go-nginx-oauth2-adapter
modulepackage
0.3.0
Repository: https://github.com/dozen/go-nginx-oauth2-adapter.git
Documentation: pkg.go.dev

# README

Circle CI

go-nginx-oauth2-adapter

a golang port for sorah/nginx_omniauth_adapter

PREREQUISITE

  • nginx with ngx_http_auth_request_module, or h2o with mruby

USAGE

$ go get github.com/shogo82148/go-nginx-oauth2-adapter/cli/go-nginx-oauth2-adapter
$ go-nginx-oauth2-adapter

CONFIGURATION

The example of configuration file.

address: ":18081" # listen address

# secret tokens to authenticate/encrypt cookie.
# see http://www.gorillatoolkit.org/pkg/sessions for more detail.
# use `-genkey` option to create strong keys.
secrets:
  - new-authentication-key
  - new-encryption-key
  - old-authentication-key
  - old-encryption-key
session_name: go-nginx-oauth2-session
app_refresh_interval: 24h

# cookie settings for saving session
cookie:
  path: /
  domain:
  max_age: 0
  secure: true # default: false. It is recommended to set true.
  http_only: true # default: false. It is recommended to set true.

providers:
  # development: {} # For test.
  google_oauth2:
    client_id: YOUR_CLIENT_ID
    client_secret: YOUR_CLIENT_SECRET
    scopes: "openid,email,profile" # default: "openid,email,profile"
    restrictions:
      - example.com # domain of your Google App
      - [email protected]

LICENSE

This software is released under the MIT License, see LICENSE.md.

SEE ALSO

# Packages

No description provided by the author
No description provided by the author

# Functions

LoggingHandler logs HTTP requests.
Main starts the go-nginx-oauth2-adapter server.
NewConfig returns a new config.
NewServer returns a new go-nginx-oauth2-adapter server.
RegisterProvider registers the OAuth provider.

# Constants

Version is the version of go-nginx-oauth2-adapter.

# Variables

ErrForbidden is the error which the access is forbidden.
ErrProviderConfigNotFound is the error which provider configure is not found.

# Structs

Config is a configration for go-nginx-oauth2-adapter.
CookieConfig is a configration for the cookie of HTTP.
Server is the go-nginx-oauth2-adapter server.

# Interfaces

Provider is an OAuth provider.
ProviderConfig is a config for an OAuth provider.
ProviderInfoContext is for support context.Context.