Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for NewWithClaims (0.2 sec)

  1. internal/jwt/parser_test.go

    }
    
    func mapClaimsToken(claims *MapClaims) string {
    	claims.SetAccessKey("test")
    	j := jwt.NewWithClaims(jwt.SigningMethodHS512, claims)
    	tk, _ := j.SignedString([]byte("HelloSecret"))
    	return tk
    }
    
    func standardClaimsToken(claims *StandardClaims) string {
    	claims.AccessKey = "test"
    	claims.Subject = "test"
    	j := jwt.NewWithClaims(jwt.SigningMethodHS512, claims)
    	tk, _ := j.SignedString([]byte("HelloSecret"))
    	return tk
    }
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Nov 05 19:20:08 GMT 2021
    - 6K bytes
    - Viewed (0)
  2. cmd/jwt_test.go

    )
    
    func getTokenString(accessKey, secretKey string) (string, error) {
    	claims := xjwt.NewMapClaims()
    	claims.SetExpiry(UTCNow().Add(defaultJWTExpiry))
    	claims.SetAccessKey(accessKey)
    	token := jwtgo.NewWithClaims(jwtgo.SigningMethodHS512, claims)
    	return token.SignedString([]byte(secretKey))
    }
    
    // Tests web request authenticator.
    func TestWebRequestAuthenticate(t *testing.T) {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Apr 19 16:45:14 GMT 2024
    - 4.5K bytes
    - Viewed (0)
  3. internal/config/dns/operator_dns.go

    		return nil
    	}
    
    	claims := &jwt.StandardClaims{
    		ExpiresAt: int64(15 * time.Minute),
    		Issuer:    c.username,
    		Subject:   config.EnvDNSWebhook,
    	}
    
    	token := jwt.NewWithClaims(jwt.SigningMethodHS512, claims)
    	ss, err := token.SignedString([]byte(c.password))
    	if err != nil {
    		return err
    	}
    
    	r.Header.Set("Authorization", "Bearer "+ss)
    	return nil
    }
    
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Mon Mar 06 16:56:10 GMT 2023
    - 6.6K bytes
    - Viewed (0)
  4. cmd/jwt.go

    	claims := xjwt.NewStandardClaims()
    	claims.SetExpiry(UTCNow().Add(defaultInterNodeJWTExpiry))
    	claims.SetAccessKey(accessKey)
    	claims.SetAudience(audience)
    
    	jwt := jwtgo.NewWithClaims(jwtgo.SigningMethodHS512, claims)
    	return jwt.SignedString([]byte(secretKey))
    }
    
    // Check if the request is authenticated.
    // Returns nil if the request is authenticated. errNoAuthToken if token missing.
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Apr 19 16:45:14 GMT 2024
    - 5.4K bytes
    - Viewed (0)
  5. internal/config/identity/openid/jwt_test.go

    	claimsMap.SetAccessKey("test-access")
    	if err := updateClaimsExpiry("3600", claimsMap.MapClaims); err != nil {
    		t.Error(err)
    	}
    	// Build simple token with updated expiration claim
    	token := jwtgo.NewWithClaims(jwtgo.SigningMethodHS256, claimsMap)
    	tokenString, err := token.SignedString(signKey)
    	if err != nil {
    		t.Error(err)
    	}
    
    	// Parse token to be sure it is valid
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Jan 18 07:03:17 GMT 2024
    - 8.3K bytes
    - Viewed (0)
  6. internal/auth/credentials.go

    }
    
    // JWTSignWithAccessKey - generates a session token.
    func JWTSignWithAccessKey(accessKey string, m map[string]interface{}, tokenSecret string) (string, error) {
    	m["accessKey"] = accessKey
    	jwt := jwtgo.NewWithClaims(jwtgo.SigningMethodHS512, jwtgo.MapClaims(m))
    	return jwt.SignedString([]byte(tokenSecret))
    }
    
    // ExtractClaims extracts JWT claims from a security token using a secret key
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Mar 01 21:09:42 GMT 2024
    - 11.4K bytes
    - Viewed (0)
Back to top