Documentation ¶
Index ¶
Constants ¶
View Source
const (
GoogleHandlerErrWrap = "GOOGLE SSO HANDLER ERROR :"
)
View Source
const (
HandlerTypeGoogle = "GOOGLE"
)
Variables ¶
View Source
var ( ErrorInvalidGoogleJWTClaim = fmt.Errorf("%s %s", GoogleHandlerErrWrap, "Could not Verify JWT Claim") ErrorExpiredGoogleJWTClaim = fmt.Errorf("%s %s", GoogleHandlerErrWrap, "Auth Token is Expired") ErrorMissingGoogleRSAKey = fmt.Errorf("%s %s", GoogleHandlerErrWrap, "RSA Key could not be found") )
View Source
var ( // ErrorUnsupportedHandlerType : if the header sso_type returns something we don't like ErrorUnsupportedHandlerType = fmt.Errorf("unsupported SSO Handler , please ensure you only use the following sso types %s", supportedSSOHandlers) // ErrorHandlerIsNotConfiguredProperly : if one of the handlers is nil ErrorHandlerIsNotConfiguredProperly = fmt.Errorf("this is a backend problem , please contact admin . SSO handler is not configured properly") )
View Source
var (
)Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // GoogleClientID : google client id for your app GoogleClientID string }
Config : configuration for sso handlers
type Google ¶
type Google struct {
ClientID string
}
Google : A 0 depedency Google SSO handler that adapts perfectly to any Framework as long as you can provide the http.Request Object
func (*Google) ValidateGoogleJWT ¶
func (g *Google) ValidateGoogleJWT(tokenString string) (GoogleClaims, error)
type GoogleClaims ¶
type GoogleClaims struct { Email string `json:"email"` EmailVerified bool `json:"email_verified"` FirstName string `json:"given_name"` LastName string `json:"family_name"` jwt.StandardClaims }
GoogleClaims : google jwt claims we get back from the token
type Handler ¶
type Handler interface { // VerifyUser : this method shall not write to method body !! // use this method to authenticate a client using an sso provider // you're free to choose how you want your header data to look like VerifyUser(req http.Header) (acc *entity.Account, err error) }
Handler : generic sso handler
func New ¶
New : create a new instance of an SSO Handler (this will contain all the handler types (google , apple , ...etc)) see sso.Manager
When you call the VerifyUser method , the Manager will call the appropriate handler type by checking the header For sso_type , if that is supported then it will execute whatever code exists for that handler
IE if sso_type == "GOOGLE" then it will execute the sso.Google Handler
Click to show internal directories.
Click to hide internal directories.