Documentation ¶
Index ¶
- type Config
- type Guild
- type OAuthSection
- type Session
- func (o *Session) GetGuilds(tokenResponse *TokenResponse) ([]Guild, error)
- func (o *Session) GetUser(tokenResponse *TokenResponse) (*User, error)
- func (o *Session) HandleCallback(w http.ResponseWriter, r *http.Request)
- func (o *Session) HandleLogin(w http.ResponseWriter, r *http.Request)
- func (o *Session) HandleLogout(w http.ResponseWriter, r *http.Request)
- func (o *Session) ObtainToken(code string) (*TokenResponse, error)
- func (o *Session) ReverseHandler() *WrappedReverseProxy
- func (o *Session) Route(r chi.Router)
- type SessionSection
- type TokenResponse
- type User
- type WrappedReverseProxy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ListenAddress string `yaml:"listen_address"` ProxyAddress string `yaml:"proxy_address"` HeaderName string `yaml:"header_name"` WhitelistedGuilds []string `yaml:"whitelisted_guilds"` RequireSession bool `yaml:"require_session"` IgnoredPaths []string `yaml:"ignored_paths"` AuthRoot string `yaml:"auth_root"` OAuth OAuthSection `yaml:"oauth"` Session SessionSection `yaml:"session"` }
Config ...
type Guild ¶
type Guild struct {
ID string `json:"id"`
}
Guild mini-container, we only care about ID.
type OAuthSection ¶
type OAuthSection struct { RedirectURL string `yaml:"redirect_url"` ClientID string `yaml:"client_id"` ClientSecret string `yaml:"client_secret"` // contains filtered or unexported fields }
OAuthSection ...
func (*OAuthSection) GetAuthorizationURL ¶
func (conf *OAuthSection) GetAuthorizationURL() string
GetAuthorizationURL returns blah
func (*OAuthSection) GetTokenURL ¶
func (conf *OAuthSection) GetTokenURL(code string) string
GetTokenURL returns blah
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session contains everything OAuth
func NewSessionRouter ¶
NewSessionRouter returns handler for session stuff
func (*Session) GetGuilds ¶
func (o *Session) GetGuilds(tokenResponse *TokenResponse) ([]Guild, error)
GetGuilds ...
func (*Session) GetUser ¶
func (o *Session) GetUser(tokenResponse *TokenResponse) (*User, error)
GetUser ...
func (*Session) HandleCallback ¶
func (o *Session) HandleCallback(w http.ResponseWriter, r *http.Request)
HandleCallback ...
func (*Session) HandleLogin ¶
func (o *Session) HandleLogin(w http.ResponseWriter, r *http.Request)
HandleLogin ...
func (*Session) HandleLogout ¶
func (o *Session) HandleLogout(w http.ResponseWriter, r *http.Request)
HandleLogout ...
func (*Session) ObtainToken ¶
func (o *Session) ObtainToken(code string) (*TokenResponse, error)
ObtainToken ...
func (*Session) ReverseHandler ¶
func (o *Session) ReverseHandler() *WrappedReverseProxy
ReverseHandler ...
type SessionSection ¶
SessionSection ...
type TokenResponse ¶
type TokenResponse struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` Scope string `json:"scope"` }
TokenResponse contains response from OAuth
type User ¶
type User struct { Avatar string `json:"avatar"` Discriminator string `json:"discriminator"` ID string `json:"id"` Name string `json:"username"` Whitelisted []string `json:"whitelisted"` }
User struct
type WrappedReverseProxy ¶
type WrappedReverseProxy struct { *httputil.ReverseProxy // contains filtered or unexported fields }
WrappedReverseProxy wraps httputil reverse proxy handler to provide RequireSession Support so it would redirect to login.
func (*WrappedReverseProxy) ServeHTTP ¶
func (w *WrappedReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.