Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for MapClaims (0.11 sec)

  1. internal/config/identity/openid/jwt_test.go

    			DummyRoleARN: &provider,
    		},
    		ProviderCfgs: map[string]*providerCfg{
    			"1": &provider,
    		},
    		closeRespFn: func(rc io.ReadCloser) {
    			rc.Close()
    		},
    	}
    
    	var claims jwtgo.MapClaims
    	if err = cfg.Validate(context.Background(), DummyRoleARN, token, "", "", claims); err != nil {
    		t.Fatal(err)
    	}
    }
    
    func TestJWT(t *testing.T) {
    	const jsonkey = `{"keys":
           [
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Fri May 24 23:05:23 UTC 2024
    - 8.3K bytes
    - Viewed (0)
  2. cmd/jwt.go

    func metricsRequestAuthenticate(req *http.Request) (*xjwt.MapClaims, []string, bool, error) {
    	token, err := jwtreq.AuthorizationHeaderExtractor.ExtractToken(req)
    	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) {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Mon Jul 22 07:04:48 UTC 2024
    - 4.5K bytes
    - Viewed (0)
  3. internal/jwt/parser.go

    // NewMapClaims - Initializes a new map claims
    func NewMapClaims() *MapClaims {
    	return &MapClaims{MapClaims: jwtgo.MapClaims{}}
    }
    
    // Set Adds new arbitrary claim keys and values.
    func (c *MapClaims) Set(key string, val interface{}) {
    	if c == nil {
    		return
    	}
    	c.MapClaims[key] = val
    }
    
    // Delete deletes a key named key.
    func (c *MapClaims) Delete(key string) {
    	if c == nil {
    		return
    	}
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue Sep 17 16:45:46 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  4. internal/auth/credentials.go

    	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
    func ExtractClaims(token, secretKey string) (*jwt.MapClaims, error) {
    	if token == "" || secretKey == "" {
    		return nil, errors.New("invalid argument")
    	}
    
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue May 28 17:14:16 UTC 2024
    - 12K bytes
    - Viewed (0)
  5. cmd/jwt_test.go

    	if err != nil {
    		b.Fatal(err)
    	}
    
    	b.ResetTimer()
    	b.ReportAllocs()
    	b.RunParallel(func(pb *testing.PB) {
    		for pb.Next() {
    			err = xjwt.ParseWithClaims(token, xjwt.NewMapClaims(), func(*xjwt.MapClaims) ([]byte, error) {
    				return []byte(creds.SecretKey), nil
    			})
    			if err != nil {
    				b.Fatal(err)
    			}
    		}
    	})
    }
    
    func BenchmarkAuthenticateNode(b *testing.B) {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Mon Jul 22 07:04:48 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  6. internal/config/identity/openid/jwt.go

    		}
    		return pubkey, nil
    	}
    
    	pCfg, ok := r.arnProviderCfgsMap[arn]
    	if !ok {
    		return fmt.Errorf("Role %s does not exist", arn)
    	}
    
    	mclaims := jwtgo.MapClaims(claims)
    	jwtToken, err := jp.ParseWithClaims(token, &mclaims, keyFuncCallback)
    	if err != nil {
    		// Re-populate the public key in-case the JWKS
    		// pubkeys are refreshed
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Fri Sep 06 02:46:36 UTC 2024
    - 8.4K bytes
    - Viewed (0)
  7. cmd/auth-handler.go

    func mustGetClaimsFromToken(r *http.Request) map[string]interface{} {
    	claims, _ := getClaimsFromToken(getSessionToken(r))
    	return claims
    }
    
    func getClaimsFromTokenWithSecret(token, secret string) (*xjwt.MapClaims, error) {
    	// JWT token for x-amz-security-token is signed with admin
    	// secret key, temporary credentials become invalid if
    	// server admin credentials change. This is done to ensure
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue Sep 17 16:45:46 UTC 2024
    - 26.1K bytes
    - Viewed (0)
  8. cmd/sts-handlers_test.go

    		}
    
    		// Validate claims. Check if the sshPublicKey claim is present.
    		dnClaim := claims.MapClaims[ldapActualUser].(string)
    		if dnClaim != testCase.dn {
    			c.Fatalf("Test %d: unexpected dn claim: %s", i+1, dnClaim)
    		}
    		sshPublicKeyClaim := claims.MapClaims[ldapAttribPrefix+"sshPublicKey"].([]interface{})[0].(string)
    		if sshPublicKeyClaim == "" {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Thu Oct 10 23:40:37 UTC 2024
    - 97.1K bytes
    - Viewed (0)
  9. cmd/iam.go

    	return tmpAcc, embeddedPolicy, nil
    }
    
    // getAccountWithClaims - gets information about an account with claims
    func (sys *IAMSys) getAccountWithClaims(ctx context.Context, accessKey string) (UserIdentity, *jwt.MapClaims, error) {
    	if !sys.Initialized() {
    		return UserIdentity{}, nil, errServerNotInitialized
    	}
    
    	acc, ok := sys.store.GetUser(accessKey)
    	if !ok {
    		return UserIdentity{}, nil, errNoSuchAccount
    	}
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue Oct 29 16:01:48 UTC 2024
    - 74.6K bytes
    - Viewed (0)
  10. cmd/iam-store.go

    		// non-empty session tokens.
    		if !(cred.IsServiceAccount() || cred.IsTemp()) ||
    			cred.SessionToken == "" {
    			continue
    		}
    
    		var (
    			err    error
    			claims *jwt.MapClaims
    		)
    
    		if cred.IsServiceAccount() {
    			claims, err = getClaimsFromTokenWithSecret(cred.SessionToken, cred.SecretKey)
    		} else if cred.IsTemp() {
    			var secretKey string
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Mon Oct 14 16:35:37 UTC 2024
    - 83.2K bytes
    - Viewed (0)
Back to top