From fbf92700f4c7403d1086f3e97373a686081cfe34 Mon Sep 17 00:00:00 2001 From: "marko.tikvic" Date: Tue, 7 Aug 2018 11:12:05 +0200 Subject: [PATCH] renamed package variables --- auth.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/auth.go b/auth.go index ec049c1..3783a2e 100644 --- a/auth.go +++ b/auth.go @@ -12,8 +12,8 @@ import ( "github.com/dgrijalva/jwt-go" ) -var appName = "webutility" -var secret = "webutility" +var _issuer = "webutility" +var _secret = "webutility" // TokenClaims are JWT token claims. type TokenClaims struct { @@ -29,9 +29,9 @@ type TokenClaims struct { ExpiresIn int64 `json:"expires_in"` } -func InitJWT(appName, secret string) { - appName = appName - secret = secret +func InitJWT(issuer, secret string) { + _issuer = issuer + _secret = secret } // ValidateHash hashes pass and salt and returns comparison result with resultHash @@ -93,10 +93,10 @@ func CreateAuthToken(username string, roleName string, roleID int64) (TokenClaim // initialize jwt.StandardClaims fields (anonymous struct) claims.IssuedAt = t0 claims.ExpiresAt = t1 - claims.Issuer = appName + claims.Issuer = _issuer jwtToken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) - token, err := jwtToken.SignedString([]byte(secret)) + token, err := jwtToken.SignedString([]byte(_secret)) if err != nil { return TokenClaims{}, err } @@ -204,5 +204,5 @@ func randomSalt() (s string, err error) { // secretFunc returns byte slice of API secret keyword. func secretFunc(token *jwt.Token) (interface{}, error) { - return []byte(secret), nil + return []byte(_secret), nil } -- 1.8.1.2