Documentation ¶
Index ¶
- Constants
- func GenSignature(req *http.Request, bodyData []byte, priKey string) (string, *errors.Error)
- func SecretSignature(req *http.Request, bodyData []byte, secretPub string, secretPri string) *errors.Error
- func Sign(data string, token string) (string, *errors.Error)
- func TokenSignature(req *http.Request, bodyData []byte, tokenPub string, tokenPri string) *errors.Error
- type Passport
- type Service
- type Token
Constants ¶
View Source
const ( Security = "security" Turn = "turn" Auth = "auth" RefreshTokenPub = "refresh_token_pub" RefreshTokenPubSign = "refresh_token_pub_sign" HeaderPrefix = "Twinkle-" //Uniform prefix HeaderSecretPub = HeaderPrefix + "Secret-Pub" //Secret Pub HeaderTokenPub = HeaderPrefix + "Token-Pub" //Token Public HeaderNonce = HeaderPrefix + "Nonce" //Nonce HeaderTimestamp = HeaderPrefix + "Timestamp" //Timestamp HeaderSignature = HeaderPrefix + "Signature" //Signature HeaderTokenExpire = HeaderPrefix + "Expiration" //Token Expiration BodyInside = "__b_o_d_y__" TurnBySecretURL = "/security/access/secret" TurnByRefreshURL = "/security/access/refresh" )
Variables ¶
This section is empty.
Functions ¶
func GenSignature ¶
GenSignature Sign the request data
func SecretSignature ¶
func SecretSignature(req *http.Request, bodyData []byte, secretPub string, secretPri string) *errors.Error
SecretSignature Use signatures when exchanging protocols
Types ¶
type Service ¶
type Service interface { // Turn Obtain a new token pair through refresh token // secretPub: The public key used in network transmission // sign: Parameters that are signed using secretKey Turn(secretPub string, nonce string, timestamp time.Time, sign string) (*Token, *errors.Error) // Auth Verifies the user and returns the TOKEN Auth(passport Passport) (*Token, *errors.Error) }
Click to show internal directories.
Click to hide internal directories.