Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertInterfaceArrayToStringArray(toConvert []interface{}) []string
- func CountUniqueCharacters(str string) int
- func ExtractClaimsTokenFromRequest(secret string, r *http.Request) (jwt.MapClaims, error)
- func GenerateSalt() string
- func GenerateToken(secret string, data jwt.MapClaims) (string, error)
- func GetChangePasswordToken(secret, username, redirectTo string) string
- func GetEmailConfirmationToken(secret, username, challenge string) string
- func GetEncryptedPassword(secretKey, password, salt string) string
- func GetJSONStr(toEncode interface{}) string
- func ParseToken(tokenString, secret string) (jwt.MapClaims, error)
- func UnmarshalChangePasswordToken(claims jwt.MapClaims) (string, string, error)
- func UnmarshalEmailConfirmationToken(claims jwt.MapClaims) (username, challenge string)
- func UnmarshalPayloadFromRequest(p IPayload, r *http.Request) error
- func ValidatePassword(password, username, email string) error
- func VerifyEmail(email string) error
- type BasePage
- type GrantScope
- type GrantScopes
- type IPage
- type IPayload
Constants ¶
const ( // PasswordMinChar is the minimum number of characters the password should have PasswordMinChar = 12 // PasswordMaxChar is the maximum number of characters the password should have PasswordMaxChar = 30 // PasswordMinUniqueChar is the minimum number of unique characters the password should have PasswordMinUniqueChar = 7 )
Variables ¶
var PasswordTooltip = fmt.Sprintf(passwordTooltipTemplate, PasswordMinChar, PasswordMaxChar, PasswordMinUniqueChar)
PasswordTooltip is an explanation snippet of the rules to a valid password
Functions ¶
func ConvertInterfaceArrayToStringArray ¶
func ConvertInterfaceArrayToStringArray(toConvert []interface{}) []string
ConvertInterfaceArrayToStringArray a helper method to perform conversions between []interface{} and []string
func CountUniqueCharacters ¶ added in v0.5.0
CountUniqueCharacters counts the unique characters in a string
func ExtractClaimsTokenFromRequest ¶ added in v0.4.0
ExtractClaimsTokenFromRequest extract a jwt token from a given request
func GenerateSalt ¶
func GenerateSalt() string
GenerateSalt a salt string with 16 bytes of crypto/rand data.
func GenerateToken ¶ added in v0.4.0
GenerateToken generates a jwt token
func GetChangePasswordToken ¶ added in v0.5.4
GetEmailConfirmationToken builds a token for changing password
func GetEmailConfirmationToken ¶ added in v0.4.0
GetEmailConfirmationToken builds a token for email confirmation
func GetEncryptedPassword ¶
GetEncryptedPassword builds an encrypted password with hmac(sha512)
func GetJSONStr ¶
func GetJSONStr(toEncode interface{}) string
GetJSONStr gets the full json string from the toEncode structure
func ParseToken ¶ added in v0.5.4
ParseToken extract the claims from a token string
func UnmarshalChangePasswordToken ¶ added in v0.5.4
UnmarshalChangePasswordToken verify it is an change password token and extract the extras information
func UnmarshalEmailConfirmationToken ¶ added in v0.4.0
func UnmarshalEmailConfirmationToken(claims jwt.MapClaims) (username, challenge string)
UnmarshalEmailConfirmationToken verify it is an email confirmation token and extract the extras information
func UnmarshalPayloadFromRequest ¶ added in v0.5.4
UnmarshalPayloadFromRequest initializes payload from an http request form and triggers the check function of the payload
func ValidatePassword ¶ added in v0.5.0
ValidatePassword verify if a password is valid
func VerifyEmail ¶ added in v0.5.4
VerifyEmail verify if the string is actually an email
Types ¶
type GrantScope ¶
GrantScope defines the structure of a grant scope
type GrantScopes ¶
type GrantScopes map[string]GrantScope
GrantScopes defines a map of grant scopes
func (GrantScopes) GetScopeListFromGrantScopeMap ¶
func (gss GrantScopes) GetScopeListFromGrantScopeMap() []string
GetScopeListFromGrantScopeMap builds a list of scopes from a grant scope map