gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

server_config.go (2897B)


      1 package server
      2 
      3 import (
      4 	"github.com/superseriousbusiness/oauth2/v4"
      5 )
      6 
      7 // SetTokenType token type
      8 func (s *Server) SetTokenType(tokenType string) {
      9 	s.Config.TokenType = tokenType
     10 }
     11 
     12 // SetAllowGetAccessRequest to allow GET requests for the token
     13 func (s *Server) SetAllowGetAccessRequest(allow bool) {
     14 	s.Config.AllowGetAccessRequest = allow
     15 }
     16 
     17 // SetAllowedResponseType allow the authorization types
     18 func (s *Server) SetAllowedResponseType(types ...oauth2.ResponseType) {
     19 	s.Config.AllowedResponseTypes = types
     20 }
     21 
     22 // SetAllowedGrantType allow the grant types
     23 func (s *Server) SetAllowedGrantType(types ...oauth2.GrantType) {
     24 	s.Config.AllowedGrantTypes = types
     25 }
     26 
     27 // SetClientInfoHandler get client info from request
     28 func (s *Server) SetClientInfoHandler(handler ClientInfoHandler) {
     29 	s.ClientInfoHandler = handler
     30 }
     31 
     32 // SetClientAuthorizedHandler check the client allows to use this authorization grant type
     33 func (s *Server) SetClientAuthorizedHandler(handler ClientAuthorizedHandler) {
     34 	s.ClientAuthorizedHandler = handler
     35 }
     36 
     37 // SetClientScopeHandler check the client allows to use scope
     38 func (s *Server) SetClientScopeHandler(handler ClientScopeHandler) {
     39 	s.ClientScopeHandler = handler
     40 }
     41 
     42 // SetUserAuthorizationHandler get user id from request authorization
     43 func (s *Server) SetUserAuthorizationHandler(handler UserAuthorizationHandler) {
     44 	s.UserAuthorizationHandler = handler
     45 }
     46 
     47 // SetPasswordAuthorizationHandler get user id from username and password
     48 func (s *Server) SetPasswordAuthorizationHandler(handler PasswordAuthorizationHandler) {
     49 	s.PasswordAuthorizationHandler = handler
     50 }
     51 
     52 // SetRefreshingScopeHandler check the scope of the refreshing token
     53 func (s *Server) SetRefreshingScopeHandler(handler RefreshingScopeHandler) {
     54 	s.RefreshingScopeHandler = handler
     55 }
     56 
     57 // SetRefreshingValidationHandler check if refresh_token is still valid. eg no revocation or other
     58 func (s *Server) SetRefreshingValidationHandler(handler RefreshingValidationHandler) {
     59 	s.RefreshingValidationHandler = handler
     60 }
     61 
     62 // SetResponseErrorHandler response error handling
     63 func (s *Server) SetResponseErrorHandler(handler ResponseErrorHandler) {
     64 	s.ResponseErrorHandler = handler
     65 }
     66 
     67 // SetInternalErrorHandler internal error handling
     68 func (s *Server) SetInternalErrorHandler(handler InternalErrorHandler) {
     69 	s.InternalErrorHandler = handler
     70 }
     71 
     72 // SetExtensionFieldsHandler in response to the access token with the extension of the field
     73 func (s *Server) SetExtensionFieldsHandler(handler ExtensionFieldsHandler) {
     74 	s.ExtensionFieldsHandler = handler
     75 }
     76 
     77 // SetAccessTokenExpHandler set expiration date for the access token
     78 func (s *Server) SetAccessTokenExpHandler(handler AccessTokenExpHandler) {
     79 	s.AccessTokenExpHandler = handler
     80 }
     81 
     82 // SetAuthorizeScopeHandler set scope for the access token
     83 func (s *Server) SetAuthorizeScopeHandler(handler AuthorizeScopeHandler) {
     84 	s.AuthorizeScopeHandler = handler
     85 }