Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrorBase64Decode = "Base64DecodeFailed" ErrorJSONEncode = "JSONEncodeFailed" ErrorJWTHeaderDecode = "JWTHeaderDecodeFailed" ErrorJWTHeader = "JWTHeaderInvalid" ErrorJWTClaimsDecode = "JWTClaimsDecodeFailed" ErrorJWTClaims = "JWTClaimsrInvalid" ErrorJWTTokenFormat = "JWTFormatInvalid" ErrorJWTALGInvalid = "JWTAlgInvalid" ErrorJWTSigntureInvalid = "JWTSignatureInvalid" ErrorJWTTokenExpired = "JWTTokenExpired" AlgHS256 = "HS256" TypeJWT = "JWT" )
View Source
const (
ErrorPasswordHash = "PasswordHashFailed"
)
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
CheckPassword checks the provided password against the stored password It extracts the salt from the front of the stored value, then adds it to the password and re-computes the hash
func PasswordHash ¶
PasswordHash generates a hex encoded sha1 hash of the password with crypt/rand salt The returned []byte contans the salt followed by the sha1 sum The function will only error if the install's secure random generator is not working
Types ¶
type Claims ¶
type Claims struct { Subject string `json:"sub"` Expiration int `json:"exp"` Issued int `json:"iat"` }
Claims holds the claims to be included in the payload of the JWT
Click to show internal directories.
Click to hide internal directories.