mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 04:09:40 -06:00
Bump reva
This commit is contained in:
2
vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md
generated
vendored
2
vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md
generated
vendored
@@ -155,7 +155,7 @@ stored in base64 encoded form, which was redundant with the information in the
|
||||
type Token struct {
|
||||
Raw string // Raw contains the raw token
|
||||
Method SigningMethod // Method is the signing method used or to be used
|
||||
Header map[string]interface{} // Header is the first segment of the token in decoded form
|
||||
Header map[string]any // Header is the first segment of the token in decoded form
|
||||
Claims Claims // Claims is the second segment of the token in decoded form
|
||||
Signature []byte // Signature is the third segment of the token in decoded form
|
||||
Valid bool // Valid specifies if the token is valid
|
||||
|
||||
4
vendor/github.com/golang-jwt/jwt/v5/ecdsa.go
generated
vendored
4
vendor/github.com/golang-jwt/jwt/v5/ecdsa.go
generated
vendored
@@ -55,7 +55,7 @@ func (m *SigningMethodECDSA) Alg() string {
|
||||
|
||||
// Verify implements token verification for the SigningMethod.
|
||||
// For this verify method, key must be an ecdsa.PublicKey struct
|
||||
func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key interface{}) error {
|
||||
func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key any) error {
|
||||
// Get the key
|
||||
var ecdsaKey *ecdsa.PublicKey
|
||||
switch k := key.(type) {
|
||||
@@ -89,7 +89,7 @@ func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key interf
|
||||
|
||||
// Sign implements token signing for the SigningMethod.
|
||||
// For this signing method, key must be an ecdsa.PrivateKey struct
|
||||
func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) ([]byte, error) {
|
||||
func (m *SigningMethodECDSA) Sign(signingString string, key any) ([]byte, error) {
|
||||
// Get the key
|
||||
var ecdsaKey *ecdsa.PrivateKey
|
||||
switch k := key.(type) {
|
||||
|
||||
4
vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go
generated
vendored
4
vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go
generated
vendored
@@ -23,7 +23,7 @@ func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) {
|
||||
}
|
||||
|
||||
// Parse the key
|
||||
var parsedKey interface{}
|
||||
var parsedKey any
|
||||
if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil {
|
||||
if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
|
||||
return nil, err
|
||||
@@ -50,7 +50,7 @@ func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) {
|
||||
}
|
||||
|
||||
// Parse the key
|
||||
var parsedKey interface{}
|
||||
var parsedKey any
|
||||
if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
|
||||
if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
|
||||
parsedKey = cert.PublicKey
|
||||
|
||||
4
vendor/github.com/golang-jwt/jwt/v5/ed25519.go
generated
vendored
4
vendor/github.com/golang-jwt/jwt/v5/ed25519.go
generated
vendored
@@ -33,7 +33,7 @@ func (m *SigningMethodEd25519) Alg() string {
|
||||
|
||||
// Verify implements token verification for the SigningMethod.
|
||||
// For this verify method, key must be an ed25519.PublicKey
|
||||
func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key interface{}) error {
|
||||
func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key any) error {
|
||||
var ed25519Key ed25519.PublicKey
|
||||
var ok bool
|
||||
|
||||
@@ -55,7 +55,7 @@ func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key inte
|
||||
|
||||
// Sign implements token signing for the SigningMethod.
|
||||
// For this signing method, key must be an ed25519.PrivateKey
|
||||
func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) ([]byte, error) {
|
||||
func (m *SigningMethodEd25519) Sign(signingString string, key any) ([]byte, error) {
|
||||
var ed25519Key crypto.Signer
|
||||
var ok bool
|
||||
|
||||
|
||||
4
vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go
generated
vendored
4
vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go
generated
vendored
@@ -24,7 +24,7 @@ func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) {
|
||||
}
|
||||
|
||||
// Parse the key
|
||||
var parsedKey interface{}
|
||||
var parsedKey any
|
||||
if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -49,7 +49,7 @@ func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) {
|
||||
}
|
||||
|
||||
// Parse the key
|
||||
var parsedKey interface{}
|
||||
var parsedKey any
|
||||
if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
4
vendor/github.com/golang-jwt/jwt/v5/hmac.go
generated
vendored
4
vendor/github.com/golang-jwt/jwt/v5/hmac.go
generated
vendored
@@ -55,7 +55,7 @@ func (m *SigningMethodHMAC) Alg() string {
|
||||
// about this, and why we intentionally are not supporting string as a key can
|
||||
// be found on our usage guide
|
||||
// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types.
|
||||
func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key interface{}) error {
|
||||
func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key any) error {
|
||||
// Verify the key is the right type
|
||||
keyBytes, ok := key.([]byte)
|
||||
if !ok {
|
||||
@@ -88,7 +88,7 @@ func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key interfa
|
||||
// cryptographically random source, e.g. crypto/rand. Additional information
|
||||
// about this, and why we intentionally are not supporting string as a key can
|
||||
// be found on our usage guide https://golang-jwt.github.io/jwt/usage/signing_methods/.
|
||||
func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) ([]byte, error) {
|
||||
func (m *SigningMethodHMAC) Sign(signingString string, key any) ([]byte, error) {
|
||||
if keyBytes, ok := key.([]byte); ok {
|
||||
if !m.Hash.Available() {
|
||||
return nil, ErrHashUnavailable
|
||||
|
||||
8
vendor/github.com/golang-jwt/jwt/v5/map_claims.go
generated
vendored
8
vendor/github.com/golang-jwt/jwt/v5/map_claims.go
generated
vendored
@@ -5,9 +5,9 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// MapClaims is a claims type that uses the map[string]interface{} for JSON
|
||||
// MapClaims is a claims type that uses the map[string]any for JSON
|
||||
// decoding. This is the default claims type if you don't supply one
|
||||
type MapClaims map[string]interface{}
|
||||
type MapClaims map[string]any
|
||||
|
||||
// GetExpirationTime implements the Claims interface.
|
||||
func (m MapClaims) GetExpirationTime() (*NumericDate, error) {
|
||||
@@ -73,7 +73,7 @@ func (m MapClaims) parseClaimsString(key string) (ClaimStrings, error) {
|
||||
cs = append(cs, v)
|
||||
case []string:
|
||||
cs = v
|
||||
case []interface{}:
|
||||
case []any:
|
||||
for _, a := range v {
|
||||
vs, ok := a.(string)
|
||||
if !ok {
|
||||
@@ -92,7 +92,7 @@ func (m MapClaims) parseClaimsString(key string) (ClaimStrings, error) {
|
||||
func (m MapClaims) parseString(key string) (string, error) {
|
||||
var (
|
||||
ok bool
|
||||
raw interface{}
|
||||
raw any
|
||||
iss string
|
||||
)
|
||||
raw, ok = m[key]
|
||||
|
||||
4
vendor/github.com/golang-jwt/jwt/v5/none.go
generated
vendored
4
vendor/github.com/golang-jwt/jwt/v5/none.go
generated
vendored
@@ -25,7 +25,7 @@ func (m *signingMethodNone) Alg() string {
|
||||
}
|
||||
|
||||
// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key
|
||||
func (m *signingMethodNone) Verify(signingString string, sig []byte, key interface{}) (err error) {
|
||||
func (m *signingMethodNone) Verify(signingString string, sig []byte, key any) (err error) {
|
||||
// Key must be UnsafeAllowNoneSignatureType to prevent accidentally
|
||||
// accepting 'none' signing method
|
||||
if _, ok := key.(unsafeNoneMagicConstant); !ok {
|
||||
@@ -41,7 +41,7 @@ func (m *signingMethodNone) Verify(signingString string, sig []byte, key interfa
|
||||
}
|
||||
|
||||
// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key
|
||||
func (m *signingMethodNone) Sign(signingString string, key interface{}) ([]byte, error) {
|
||||
func (m *signingMethodNone) Sign(signingString string, key any) ([]byte, error) {
|
||||
if _, ok := key.(unsafeNoneMagicConstant); ok {
|
||||
return []byte{}, nil
|
||||
}
|
||||
|
||||
25
vendor/github.com/golang-jwt/jwt/v5/parser_option.go
generated
vendored
25
vendor/github.com/golang-jwt/jwt/v5/parser_option.go
generated
vendored
@@ -66,20 +66,37 @@ func WithExpirationRequired() ParserOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithAudience configures the validator to require the specified audience in
|
||||
// the `aud` claim. Validation will fail if the audience is not listed in the
|
||||
// token or the `aud` claim is missing.
|
||||
// WithAudience configures the validator to require any of the specified
|
||||
// audiences in the `aud` claim. Validation will fail if the audience is not
|
||||
// listed in the token or the `aud` claim is missing.
|
||||
//
|
||||
// NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is
|
||||
// application-specific. Since this validation API is helping developers in
|
||||
// writing secure application, we decided to REQUIRE the existence of the claim,
|
||||
// if an audience is expected.
|
||||
func WithAudience(aud string) ParserOption {
|
||||
func WithAudience(aud ...string) ParserOption {
|
||||
return func(p *Parser) {
|
||||
p.validator.expectedAud = aud
|
||||
}
|
||||
}
|
||||
|
||||
// WithAllAudiences configures the validator to require all the specified
|
||||
// audiences in the `aud` claim. Validation will fail if the specified audiences
|
||||
// are not listed in the token or the `aud` claim is missing. Duplicates within
|
||||
// the list are de-duplicated since internally, we use a map to look up the
|
||||
// audiences.
|
||||
//
|
||||
// NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is
|
||||
// application-specific. Since this validation API is helping developers in
|
||||
// writing secure application, we decided to REQUIRE the existence of the claim,
|
||||
// if an audience is expected.
|
||||
func WithAllAudiences(aud ...string) ParserOption {
|
||||
return func(p *Parser) {
|
||||
p.validator.expectedAud = aud
|
||||
p.validator.expectAllAud = true
|
||||
}
|
||||
}
|
||||
|
||||
// WithIssuer configures the validator to require the specified issuer in the
|
||||
// `iss` claim. Validation will fail if a different issuer is specified in the
|
||||
// token or the `iss` claim is missing.
|
||||
|
||||
4
vendor/github.com/golang-jwt/jwt/v5/rsa.go
generated
vendored
4
vendor/github.com/golang-jwt/jwt/v5/rsa.go
generated
vendored
@@ -46,7 +46,7 @@ func (m *SigningMethodRSA) Alg() string {
|
||||
|
||||
// Verify implements token verification for the SigningMethod
|
||||
// For this signing method, must be an *rsa.PublicKey structure.
|
||||
func (m *SigningMethodRSA) Verify(signingString string, sig []byte, key interface{}) error {
|
||||
func (m *SigningMethodRSA) Verify(signingString string, sig []byte, key any) error {
|
||||
var rsaKey *rsa.PublicKey
|
||||
var ok bool
|
||||
|
||||
@@ -67,7 +67,7 @@ func (m *SigningMethodRSA) Verify(signingString string, sig []byte, key interfac
|
||||
|
||||
// Sign implements token signing for the SigningMethod
|
||||
// For this signing method, must be an *rsa.PrivateKey structure.
|
||||
func (m *SigningMethodRSA) Sign(signingString string, key interface{}) ([]byte, error) {
|
||||
func (m *SigningMethodRSA) Sign(signingString string, key any) ([]byte, error) {
|
||||
var rsaKey *rsa.PrivateKey
|
||||
var ok bool
|
||||
|
||||
|
||||
4
vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go
generated
vendored
4
vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go
generated
vendored
@@ -82,7 +82,7 @@ func init() {
|
||||
|
||||
// Verify implements token verification for the SigningMethod.
|
||||
// For this verify method, key must be an rsa.PublicKey struct
|
||||
func (m *SigningMethodRSAPSS) Verify(signingString string, sig []byte, key interface{}) error {
|
||||
func (m *SigningMethodRSAPSS) Verify(signingString string, sig []byte, key any) error {
|
||||
var rsaKey *rsa.PublicKey
|
||||
switch k := key.(type) {
|
||||
case *rsa.PublicKey:
|
||||
@@ -108,7 +108,7 @@ func (m *SigningMethodRSAPSS) Verify(signingString string, sig []byte, key inter
|
||||
|
||||
// Sign implements token signing for the SigningMethod.
|
||||
// For this signing method, key must be an rsa.PrivateKey struct
|
||||
func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) ([]byte, error) {
|
||||
func (m *SigningMethodRSAPSS) Sign(signingString string, key any) ([]byte, error) {
|
||||
var rsaKey *rsa.PrivateKey
|
||||
|
||||
switch k := key.(type) {
|
||||
|
||||
6
vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go
generated
vendored
6
vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go
generated
vendored
@@ -23,7 +23,7 @@ func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) {
|
||||
return nil, ErrKeyMustBePEMEncoded
|
||||
}
|
||||
|
||||
var parsedKey interface{}
|
||||
var parsedKey any
|
||||
if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil {
|
||||
if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
|
||||
return nil, err
|
||||
@@ -53,7 +53,7 @@ func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.Pr
|
||||
return nil, ErrKeyMustBePEMEncoded
|
||||
}
|
||||
|
||||
var parsedKey interface{}
|
||||
var parsedKey any
|
||||
|
||||
var blockDecrypted []byte
|
||||
if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil {
|
||||
@@ -86,7 +86,7 @@ func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
|
||||
}
|
||||
|
||||
// Parse the key
|
||||
var parsedKey interface{}
|
||||
var parsedKey any
|
||||
if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
|
||||
if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
|
||||
parsedKey = cert.PublicKey
|
||||
|
||||
6
vendor/github.com/golang-jwt/jwt/v5/signing_method.go
generated
vendored
6
vendor/github.com/golang-jwt/jwt/v5/signing_method.go
generated
vendored
@@ -12,9 +12,9 @@ var signingMethodLock = new(sync.RWMutex)
|
||||
// signature in Sign. The signature is then usually base64 encoded as part of a
|
||||
// JWT.
|
||||
type SigningMethod interface {
|
||||
Verify(signingString string, sig []byte, key interface{}) error // Returns nil if signature is valid
|
||||
Sign(signingString string, key interface{}) ([]byte, error) // Returns signature or error
|
||||
Alg() string // returns the alg identifier for this method (example: 'HS256')
|
||||
Verify(signingString string, sig []byte, key any) error // Returns nil if signature is valid
|
||||
Sign(signingString string, key any) ([]byte, error) // Returns signature or error
|
||||
Alg() string // returns the alg identifier for this method (example: 'HS256')
|
||||
}
|
||||
|
||||
// RegisterSigningMethod registers the "alg" name and a factory function for signing method.
|
||||
|
||||
20
vendor/github.com/golang-jwt/jwt/v5/token.go
generated
vendored
20
vendor/github.com/golang-jwt/jwt/v5/token.go
generated
vendored
@@ -11,9 +11,9 @@ import (
|
||||
// Token. This allows you to use properties in the Header of the token (such as
|
||||
// `kid`) to identify which key to use.
|
||||
//
|
||||
// The returned interface{} may be a single key or a VerificationKeySet containing
|
||||
// The returned any may be a single key or a VerificationKeySet containing
|
||||
// multiple keys.
|
||||
type Keyfunc func(*Token) (interface{}, error)
|
||||
type Keyfunc func(*Token) (any, error)
|
||||
|
||||
// VerificationKey represents a public or secret key for verifying a token's signature.
|
||||
type VerificationKey interface {
|
||||
@@ -28,12 +28,12 @@ type VerificationKeySet struct {
|
||||
// Token represents a JWT Token. Different fields will be used depending on
|
||||
// whether you're creating or parsing/verifying a token.
|
||||
type Token struct {
|
||||
Raw string // Raw contains the raw token. Populated when you [Parse] a token
|
||||
Method SigningMethod // Method is the signing method used or to be used
|
||||
Header map[string]interface{} // Header is the first segment of the token in decoded form
|
||||
Claims Claims // Claims is the second segment of the token in decoded form
|
||||
Signature []byte // Signature is the third segment of the token in decoded form. Populated when you Parse a token
|
||||
Valid bool // Valid specifies if the token is valid. Populated when you Parse/Verify a token
|
||||
Raw string // Raw contains the raw token. Populated when you [Parse] a token
|
||||
Method SigningMethod // Method is the signing method used or to be used
|
||||
Header map[string]any // Header is the first segment of the token in decoded form
|
||||
Claims Claims // Claims is the second segment of the token in decoded form
|
||||
Signature []byte // Signature is the third segment of the token in decoded form. Populated when you Parse a token
|
||||
Valid bool // Valid specifies if the token is valid. Populated when you Parse/Verify a token
|
||||
}
|
||||
|
||||
// New creates a new [Token] with the specified signing method and an empty map
|
||||
@@ -46,7 +46,7 @@ func New(method SigningMethod, opts ...TokenOption) *Token {
|
||||
// claims. Additional options can be specified, but are currently unused.
|
||||
func NewWithClaims(method SigningMethod, claims Claims, opts ...TokenOption) *Token {
|
||||
return &Token{
|
||||
Header: map[string]interface{}{
|
||||
Header: map[string]any{
|
||||
"typ": "JWT",
|
||||
"alg": method.Alg(),
|
||||
},
|
||||
@@ -60,7 +60,7 @@ func NewWithClaims(method SigningMethod, claims Claims, opts ...TokenOption) *To
|
||||
// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types
|
||||
// for an overview of the different signing methods and their respective key
|
||||
// types.
|
||||
func (t *Token) SignedString(key interface{}) (string, error) {
|
||||
func (t *Token) SignedString(key any) (string, error) {
|
||||
sstr, err := t.SigningString()
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
4
vendor/github.com/golang-jwt/jwt/v5/types.go
generated
vendored
4
vendor/github.com/golang-jwt/jwt/v5/types.go
generated
vendored
@@ -103,7 +103,7 @@ func (date *NumericDate) UnmarshalJSON(b []byte) (err error) {
|
||||
type ClaimStrings []string
|
||||
|
||||
func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) {
|
||||
var value interface{}
|
||||
var value any
|
||||
|
||||
if err = json.Unmarshal(data, &value); err != nil {
|
||||
return err
|
||||
@@ -116,7 +116,7 @@ func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) {
|
||||
aud = append(aud, v)
|
||||
case []string:
|
||||
aud = ClaimStrings(v)
|
||||
case []interface{}:
|
||||
case []any:
|
||||
for _, vv := range v {
|
||||
vs, ok := vv.(string)
|
||||
if !ok {
|
||||
|
||||
50
vendor/github.com/golang-jwt/jwt/v5/validator.go
generated
vendored
50
vendor/github.com/golang-jwt/jwt/v5/validator.go
generated
vendored
@@ -1,8 +1,8 @@
|
||||
package jwt
|
||||
|
||||
import (
|
||||
"crypto/subtle"
|
||||
"fmt"
|
||||
"slices"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -52,8 +52,12 @@ type Validator struct {
|
||||
verifyIat bool
|
||||
|
||||
// expectedAud contains the audience this token expects. Supplying an empty
|
||||
// string will disable aud checking.
|
||||
expectedAud string
|
||||
// slice will disable aud checking.
|
||||
expectedAud []string
|
||||
|
||||
// expectAllAud specifies whether all expected audiences must be present in
|
||||
// the token. If false, only one of the expected audiences must be present.
|
||||
expectAllAud bool
|
||||
|
||||
// expectedIss contains the issuer this token expects. Supplying an empty
|
||||
// string will disable iss checking.
|
||||
@@ -88,7 +92,7 @@ func NewValidator(opts ...ParserOption) *Validator {
|
||||
func (v *Validator) Validate(claims Claims) error {
|
||||
var (
|
||||
now time.Time
|
||||
errs []error = make([]error, 0, 6)
|
||||
errs = make([]error, 0, 6)
|
||||
err error
|
||||
)
|
||||
|
||||
@@ -120,8 +124,8 @@ func (v *Validator) Validate(claims Claims) error {
|
||||
}
|
||||
|
||||
// If we have an expected audience, we also require the audience claim
|
||||
if v.expectedAud != "" {
|
||||
if err = v.verifyAudience(claims, v.expectedAud, true); err != nil {
|
||||
if len(v.expectedAud) > 0 {
|
||||
if err = v.verifyAudience(claims, v.expectedAud, v.expectAllAud); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
@@ -226,33 +230,39 @@ func (v *Validator) verifyNotBefore(claims Claims, cmp time.Time, required bool)
|
||||
//
|
||||
// Additionally, if any error occurs while retrieving the claim, e.g., when its
|
||||
// the wrong type, an ErrTokenUnverifiable error will be returned.
|
||||
func (v *Validator) verifyAudience(claims Claims, cmp string, required bool) error {
|
||||
func (v *Validator) verifyAudience(claims Claims, cmp []string, expectAllAud bool) error {
|
||||
aud, err := claims.GetAudience()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(aud) == 0 {
|
||||
// Check that aud exists and is not empty. We only require the aud claim
|
||||
// if we expect at least one audience to be present.
|
||||
if len(aud) == 0 || len(aud) == 1 && aud[0] == "" {
|
||||
required := len(v.expectedAud) > 0
|
||||
return errorIfRequired(required, "aud")
|
||||
}
|
||||
|
||||
// use a var here to keep constant time compare when looping over a number of claims
|
||||
result := false
|
||||
|
||||
var stringClaims string
|
||||
for _, a := range aud {
|
||||
if subtle.ConstantTimeCompare([]byte(a), []byte(cmp)) != 0 {
|
||||
result = true
|
||||
if !expectAllAud {
|
||||
for _, a := range aud {
|
||||
// If we only expect one match, we can stop early if we find a match
|
||||
if slices.Contains(cmp, a) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
stringClaims = stringClaims + a
|
||||
|
||||
return ErrTokenInvalidAudience
|
||||
}
|
||||
|
||||
// case where "" is sent in one or many aud claims
|
||||
if stringClaims == "" {
|
||||
return errorIfRequired(required, "aud")
|
||||
// Note that we are looping cmp here to ensure that all expected audiences
|
||||
// are present in the aud claim.
|
||||
for _, a := range cmp {
|
||||
if !slices.Contains(aud, a) {
|
||||
return ErrTokenInvalidAudience
|
||||
}
|
||||
}
|
||||
|
||||
return errorIfFalse(result, ErrTokenInvalidAudience)
|
||||
return nil
|
||||
}
|
||||
|
||||
// verifyIssuer compares the iss claim in claims against cmp.
|
||||
|
||||
5
vendor/github.com/opencloud-eu/reva/v2/internal/http/interceptors/log/log.go
generated
vendored
5
vendor/github.com/opencloud-eu/reva/v2/internal/http/interceptors/log/log.go
generated
vendored
@@ -130,6 +130,7 @@ type commonLoggingResponseWriter interface {
|
||||
http.Flusher
|
||||
Status() int
|
||||
Size() int
|
||||
Unwrap() http.ResponseWriter
|
||||
}
|
||||
|
||||
// responseLogger is wrapper of http.ResponseWriter that keeps track of its HTTP
|
||||
@@ -170,6 +171,10 @@ func (l *responseLogger) Flush() {
|
||||
}
|
||||
}
|
||||
|
||||
func (l *responseLogger) Unwrap() http.ResponseWriter {
|
||||
return l.w
|
||||
}
|
||||
|
||||
type hijackLogger struct {
|
||||
responseLogger
|
||||
}
|
||||
|
||||
49
vendor/github.com/opencloud-eu/reva/v2/pkg/events/raw/mocks/Stream.go
generated
vendored
49
vendor/github.com/opencloud-eu/reva/v2/pkg/events/raw/mocks/Stream.go
generated
vendored
@@ -21,7 +21,9 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
jetstream "github.com/nats-io/nats.go/jetstream"
|
||||
events "github.com/opencloud-eu/reva/v2/pkg/events"
|
||||
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
raw "github.com/opencloud-eu/reva/v2/pkg/events/raw"
|
||||
@@ -112,6 +114,53 @@ func (_c *Stream_Consume_Call) RunAndReturn(run func(string, ...events.Unmarshal
|
||||
return _c
|
||||
}
|
||||
|
||||
// JetStream provides a mock function with no fields
|
||||
func (_m *Stream) JetStream() jetstream.Stream {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for JetStream")
|
||||
}
|
||||
|
||||
var r0 jetstream.Stream
|
||||
if rf, ok := ret.Get(0).(func() jetstream.Stream); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(jetstream.Stream)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Stream_JetStream_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'JetStream'
|
||||
type Stream_JetStream_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// JetStream is a helper method to define mock.On call
|
||||
func (_e *Stream_Expecter) JetStream() *Stream_JetStream_Call {
|
||||
return &Stream_JetStream_Call{Call: _e.mock.On("JetStream")}
|
||||
}
|
||||
|
||||
func (_c *Stream_JetStream_Call) Run(run func()) *Stream_JetStream_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Stream_JetStream_Call) Return(_a0 jetstream.Stream) *Stream_JetStream_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Stream_JetStream_Call) RunAndReturn(run func() jetstream.Stream) *Stream_JetStream_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewStream creates a new instance of Stream. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewStream(t interface {
|
||||
|
||||
11
vendor/github.com/opencloud-eu/reva/v2/pkg/events/raw/raw.go
generated
vendored
11
vendor/github.com/opencloud-eu/reva/v2/pkg/events/raw/raw.go
generated
vendored
@@ -62,10 +62,11 @@ func (re *Event) InProgress() error {
|
||||
|
||||
type Stream interface {
|
||||
Consume(group string, evs ...events.Unmarshaller) (<-chan Event, error)
|
||||
JetStream() jetstream.Stream
|
||||
}
|
||||
|
||||
type RawStream struct {
|
||||
Js jetstream.Stream
|
||||
js jetstream.Stream
|
||||
|
||||
c Config
|
||||
}
|
||||
@@ -130,7 +131,7 @@ func FromConfig(ctx context.Context, name string, cfg Config) (Stream, error) {
|
||||
}
|
||||
|
||||
s = &RawStream{
|
||||
Js: js,
|
||||
js: js,
|
||||
c: cfg,
|
||||
}
|
||||
return nil
|
||||
@@ -186,7 +187,7 @@ func (s *RawStream) Consume(group string, evs ...events.Unmarshaller) (<-chan Ev
|
||||
}
|
||||
|
||||
func (s *RawStream) consumeRaw(group string) (<-chan RawEvent, error) {
|
||||
consumer, err := s.Js.CreateOrUpdateConsumer(context.Background(), jetstream.ConsumerConfig{
|
||||
consumer, err := s.js.CreateOrUpdateConsumer(context.Background(), jetstream.ConsumerConfig{
|
||||
Durable: group,
|
||||
DeliverPolicy: jetstream.DeliverNewPolicy,
|
||||
AckPolicy: jetstream.AckExplicitPolicy, // Require manual acknowledgment
|
||||
@@ -214,3 +215,7 @@ func (s *RawStream) consumeRaw(group string) (<-chan RawEvent, error) {
|
||||
|
||||
return channel, nil
|
||||
}
|
||||
|
||||
func (s *RawStream) JetStream() jetstream.Stream {
|
||||
return s.js
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user