Documentation ¶
Overview ¶
Package rest provides an http oauth REST API
Index ¶
- Constants
- Variables
- type Option
- func WithAddr(addr string) Option
- func WithAllowPasswordGrant(allow bool) Option
- func WithAllowSignup(allow bool) Option
- func WithBasepath(basePath string) Option
- func WithCodeStore(store oauth.CodeStore) Option
- func WithLogger(logger *logrus.Logger) Option
- func WithRouter(router *mux.Router) Option
- func WithSessionCookieName(name string) Option
- func WithSessionIntervals(lifetime, timeout time.Duration) Option
- func WithSessionStore(store sessions.Store) Option
- type Server
Constants ¶
View Source
const ( // AuthRequestParam is the name of the request token parameter AuthRequestParam = "request_token" // SessionCookie is the name the session cookie SessionCookie = "_atomic_session" )
View Source
const ( // Name the server name Name = "libatomic-oauth" // Version is the binary version Version = "1.0.0" )
Variables ¶
View Source
var ( // SwaggerJSON embedded version of the swagger document used at generation time SwaggerJSON json.RawMessage // FlatSwaggerJSON embedded flattened version of the swagger document used at generation time FlatSwaggerJSON json.RawMessage SpecDoc *loads.Document )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Server)
Option provides the server options, these will override th defaults and instance values.
func WithAllowPasswordGrant ¶
WithAllowPasswordGrant enables password grants which require client secrets
func WithAllowSignup ¶
WithAllowSignup enables the signup/register paths
func WithCodeStore ¶
WithCodeStore sets the code store for the server
func WithSessionCookieName ¶
WithSessionCookieName sets the session cookie name
func WithSessionIntervals ¶
WithSessionIntervals sets the session lifetime and activity timeout
func WithSessionStore ¶
WithSessionStore sets the session store
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an API server it can be used standalone vi Server() or integrared via Handler()
func New ¶
func New(ctrl oauth.Controller, signingKey *rsa.PrivateKey, opts ...Option) *Server
New returns a new Server instance
func (*Server) AuthorizeRequest ¶
func (s *Server) AuthorizeRequest(r *http.Request, scope ...oauth.Permissions) (oauth.Context, error)
AuthorizeRequest implements the auth.Authorizer interface
Source Files ¶
Click to show internal directories.
Click to hide internal directories.