Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for NewMapClaims (0.18 sec)

  1. cmd/jwt_test.go

    	"net/http"
    	"os"
    	"testing"
    
    	jwtgo "github.com/golang-jwt/jwt/v4"
    	xjwt "github.com/minio/minio/internal/jwt"
    )
    
    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))
    }
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Apr 19 16:45:14 GMT 2024
    - 4.5K bytes
    - Viewed (0)
  2. internal/jwt/parser.go

    	}
    
    	if c.AccessKey == "" && c.Subject == "" {
    		return jwtgo.NewValidationError("accessKey/sub missing",
    			jwtgo.ValidationErrorClaimsInvalid)
    	}
    
    	return nil
    }
    
    // NewMapClaims - Initializes a new map claims
    func NewMapClaims() *MapClaims {
    	return &MapClaims{MapClaims: jwtgo.MapClaims{}}
    }
    
    // Lookup returns the value and if the key is found.
    func (c *MapClaims) Lookup(key string) (value string, ok bool) {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Tue May 09 07:53:08 GMT 2023
    - 13.9K bytes
    - Viewed (0)
  3. cmd/jwt.go

    	if err != nil {
    		if err == jwtreq.ErrNoTokenInRequest {
    			return nil, nil, false, errNoAuthToken
    		}
    		return nil, nil, false, err
    	}
    	claims := xjwt.NewMapClaims()
    	if err := xjwt.ParseWithClaims(token, claims, func(claims *xjwt.MapClaims) ([]byte, error) {
    		if claims.AccessKey != globalActiveCred.AccessKey {
    			u, ok := globalIAMSys.GetUser(req.Context(), claims.AccessKey)
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Apr 19 16:45:14 GMT 2024
    - 5.4K bytes
    - Viewed (0)
  4. internal/config/identity/openid/jwt_test.go

    	claimsMap := jwtm.NewMapClaims()
    	claimsMap.SetExpiry(time.Now().Add(time.Minute))
    	claimsMap.SetAccessKey("test-access")
    	if err := updateClaimsExpiry("3600", claimsMap.MapClaims); err != nil {
    		t.Error(err)
    	}
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Jan 18 07:03:17 GMT 2024
    - 8.3K bytes
    - Viewed (0)
  5. internal/auth/credentials.go

    func ExtractClaims(token, secretKey string) (*jwt.MapClaims, error) {
    	if token == "" || secretKey == "" {
    		return nil, errors.New("invalid argument")
    	}
    
    	claims := jwt.NewMapClaims()
    	stsTokenCallback := func(claims *jwt.MapClaims) ([]byte, error) {
    		return []byte(secretKey), nil
    	}
    
    	if err := jwt.ParseWithClaims(token, claims, stsTokenCallback); err != nil {
    		return nil, err
    	}
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Mar 01 21:09:42 GMT 2024
    - 11.4K bytes
    - Viewed (0)
  6. cmd/auth-handler.go

    	if token != "" {
    		claims, err := getClaimsFromTokenWithSecret(token, secret)
    		if err != nil {
    			return nil, toAPIErrorCode(r.Context(), err)
    		}
    		return claims, ErrNone
    	}
    
    	claims := xjwt.NewMapClaims()
    	return claims.Map(), ErrNone
    }
    
    // Check request auth type verifies the incoming http request
    //   - validates the request signature
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 26K bytes
    - Viewed (0)
Back to top