// Verify checks the given credentials
Verify checks the given credentials
// Verify checks the given credentials
func (v *Verifier) Verify(ctx context.Context, req *dockerregistryproxyv1.VerifyRequest) (*empty.Empty, error) {
	claims, err := gcp.GetTokenClaims(req.GetPassword(), v.certificateManager)
	if err != nil {
		return nil, err
	}
	if found := gcp.CheckStringWhitelist(claims.Audience, v.audiences); !found {
		return nil, fmt.Errorf("%s: %w", claims.Audience, gcp.ErrAudienceNotWhitelisted)
	}
	if found := gcp.CheckStringWhitelist(claims.Google.ComputeEngine.ProjectID, v.projectIDs); !found {
		return nil, fmt.Errorf("%s: %w", claims.Google.ComputeEngine.ProjectID, gcp.ErrProjectIDNotWhitelisted)
	}
	if found := gcp.CheckStringWhitelist(claims.Google.ComputeEngine.Zone, v.zones); !found {
		return nil, fmt.Errorf("%s: %w", claims.Google.ComputeEngine.Zone, gcp.ErrZoneNotWhitelisted)
	}
	for _, licenseID := range claims.Google.ComputeEngine.LicenseIDs {
		if found := gcp.CheckStringWhitelist(licenseID, v.licenseIDs); !found {
			return nil, fmt.Errorf("%s: %w", licenseID, gcp.ErrLicenseIDWhitelisted)
		}
	}
	return &empty.Empty{}, nil
}
func ( v * Verifier ) Verify ( ctx context . Context , req * dockerregistryproxyv1 . VerifyRequest ) ( * empty . Empty , error ) { claims , err := gcp . GetTokenClaims ( req . GetPassword ( ) , v . certificateManager ) if err != nil { return nil , err } if found := gcp . CheckStringWhitelist ( claims . Audience , v . audiences ) ; ! found { return nil , fmt . Errorf ( " " , claims . Audience , gcp . ErrAudienceNotWhitelisted ) } if found := gcp . CheckStringWhitelist ( claims . Google . ComputeEngine . ProjectID , v . projectIDs ) ; ! found { return nil , fmt . Errorf ( " " , claims . Google . ComputeEngine . ProjectID , gcp . ErrProjectIDNotWhitelisted ) } if found := gcp . CheckStringWhitelist ( claims . Google . ComputeEngine . Zone , v . zones ) ; ! found { return nil , fmt . Errorf ( " " , claims . Google . ComputeEngine . Zone , gcp . ErrZoneNotWhitelisted ) } for _ , licenseID := range claims . Google . ComputeEngine . LicenseIDs { if found := gcp . CheckStringWhitelist ( licenseID , v . licenseIDs ) ; ! found { return nil , fmt . Errorf ( " " , licenseID , gcp . ErrLicenseIDWhitelisted ) } } return & empty . Empty { } , nil }
Verify checks the given credentials
Verify checks the given credentials