Documentation
¶
Index ¶
- type Controller
- func (h *Controller) AttachMiddleware(fn http.HandlerFunc) http.HandlerFunc
- func (h *Controller) HandleRequests(w http.ResponseWriter, r *http.Request)
- func (h *Controller) IPAddressMiddleware(fn http.HandlerFunc) http.HandlerFunc
- func (h *Controller) OSINProcessorMiddleware(fn http.HandlerFunc) http.HandlerFunc
- func (h *Controller) PaginationMiddleware(fn http.HandlerFunc) http.HandlerFunc
- func (h *Controller) ProtectedURLsMiddleware(fn http.HandlerFunc) http.HandlerFunc
- func (h *Controller) URLProcessorMiddleware(fn http.HandlerFunc) http.HandlerFunc
- type OSINRedisStorage
- func (s *OSINRedisStorage) Clone() osin.Storage
- func (s *OSINRedisStorage) Close()
- func (s *OSINRedisStorage) CreateClient(client osin.Client) error
- func (s *OSINRedisStorage) DeleteClient(client osin.Client) error
- func (s *OSINRedisStorage) GetClient(id string) (osin.Client, error)
- func (s *OSINRedisStorage) LoadAccess(token string) (*osin.AccessData, error)
- func (s *OSINRedisStorage) LoadAuthorize(code string) (*osin.AuthorizeData, error)
- func (s *OSINRedisStorage) LoadRefresh(token string) (*osin.AccessData, error)
- func (s *OSINRedisStorage) RemoveAccess(token string) error
- func (s *OSINRedisStorage) RemoveAuthorize(code string) (err error)
- func (s *OSINRedisStorage) RemoveRefresh(token string) error
- func (s *OSINRedisStorage) SaveAccess(data *osin.AccessData) (err error)
- func (s *OSINRedisStorage) SaveAuthorize(data *osin.AuthorizeData) (err error)
- func (s *OSINRedisStorage) UpdateClient(client osin.Client) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct { Config map[string]string OAuthServer *osin.Server OAuthStorage *OSINRedisStorage TenantRepo models.TenantRepository UserRepo models.UserRepository ApplicationRepo models.ApplicationRepository ApplicationLiteRepo models.ApplicationLiteRepository AuthorizedApplicationRepo models.AuthorizedApplicationRepository AuthorizedApplicationLiteRepo models.AuthorizedApplicationLiteRepository SessionManager *session.SessionManager }
func (*Controller) AttachMiddleware ¶
func (h *Controller) AttachMiddleware(fn http.HandlerFunc) http.HandlerFunc
func (*Controller) HandleRequests ¶
func (h *Controller) HandleRequests(w http.ResponseWriter, r *http.Request)
func (*Controller) IPAddressMiddleware ¶
func (h *Controller) IPAddressMiddleware(fn http.HandlerFunc) http.HandlerFunc
func (*Controller) OSINProcessorMiddleware ¶
func (h *Controller) OSINProcessorMiddleware(fn http.HandlerFunc) http.HandlerFunc
func (*Controller) PaginationMiddleware ¶
func (h *Controller) PaginationMiddleware(fn http.HandlerFunc) http.HandlerFunc
func (*Controller) ProtectedURLsMiddleware ¶
func (h *Controller) ProtectedURLsMiddleware(fn http.HandlerFunc) http.HandlerFunc
The purpose of this middleware is to return a `401 unauthorized` error if the user is not authorized and visiting a protected URL.
func (*Controller) URLProcessorMiddleware ¶
func (h *Controller) URLProcessorMiddleware(fn http.HandlerFunc) http.HandlerFunc
Middleware will split the full URL path into slash-sperated parts and save to the context to flow downstream in the app for this particular request.
type OSINRedisStorage ¶
type OSINRedisStorage struct {
// contains filtered or unexported fields
}
OSINRedisStorage implements "github.com/RangelReale/osin".OSINRedisStorage
func New ¶
func New(pool *redis.Pool, keyPrefix string) *OSINRedisStorage
New initializes and returns a new OSINRedisStorage
func NewOSINRedisStorage ¶
func NewOSINRedisStorage() *OSINRedisStorage
func (*OSINRedisStorage) Clone ¶
func (s *OSINRedisStorage) Clone() osin.Storage
Clone the storage if needed. For example, using mgo, you can clone the session with session.Clone to avoid concurrent access problems. This is to avoid cloning the connection at each method access. Can return itself if not a problem.
func (*OSINRedisStorage) Close ¶
func (s *OSINRedisStorage) Close()
Close the resources the OSINRedisStorage potentially holds (using Clone for example)
func (*OSINRedisStorage) CreateClient ¶
func (s *OSINRedisStorage) CreateClient(client osin.Client) error
CreateClient inserts a new client
func (*OSINRedisStorage) DeleteClient ¶
func (s *OSINRedisStorage) DeleteClient(client osin.Client) error
DeleteClient deletes given client
func (*OSINRedisStorage) GetClient ¶
func (s *OSINRedisStorage) GetClient(id string) (osin.Client, error)
GetClient gets a client by ID
func (*OSINRedisStorage) LoadAccess ¶
func (s *OSINRedisStorage) LoadAccess(token string) (*osin.AccessData, error)
LoadAccess gets access data with given access token
func (*OSINRedisStorage) LoadAuthorize ¶
func (s *OSINRedisStorage) LoadAuthorize(code string) (*osin.AuthorizeData, error)
LoadAuthorize looks up AuthorizeData by a code. Client information MUST be loaded together. Optionally can return error if expired.
func (*OSINRedisStorage) LoadRefresh ¶
func (s *OSINRedisStorage) LoadRefresh(token string) (*osin.AccessData, error)
LoadRefresh gets access data with given refresh token
func (*OSINRedisStorage) RemoveAccess ¶
func (s *OSINRedisStorage) RemoveAccess(token string) error
RemoveAccess deletes AccessData with given access token
func (*OSINRedisStorage) RemoveAuthorize ¶
func (s *OSINRedisStorage) RemoveAuthorize(code string) (err error)
RemoveAuthorize revokes or deletes the authorization code.
func (*OSINRedisStorage) RemoveRefresh ¶
func (s *OSINRedisStorage) RemoveRefresh(token string) error
RemoveRefresh deletes AccessData with given refresh token
func (*OSINRedisStorage) SaveAccess ¶
func (s *OSINRedisStorage) SaveAccess(data *osin.AccessData) (err error)
SaveAccess creates AccessData.
func (*OSINRedisStorage) SaveAuthorize ¶
func (s *OSINRedisStorage) SaveAuthorize(data *osin.AuthorizeData) (err error)
SaveAuthorize saves authorize data.
func (*OSINRedisStorage) UpdateClient ¶
func (s *OSINRedisStorage) UpdateClient(client osin.Client) error
UpdateClient updates a client