// Validate validates a new token func (s strategy) Validate(ctx kapi.Context, obj runtime.Object) field.ErrorList { token := obj.(*api.OAuthAuthorizeToken) validationErrors := validation.ValidateAuthorizeToken(token) client, err := s.clientGetter.GetClient(ctx, token.ClientName) if err != nil { return append(validationErrors, field.InternalError(field.NewPath("clientName"), err)) } if err := scopeauthorizer.ValidateScopeRestrictions(client, token.Scopes...); err != nil { return append(validationErrors, field.InternalError(field.NewPath("clientName"), err)) } return validationErrors }
// Validate validates a new token func (strategy) Validate(ctx kapi.Context, obj runtime.Object) fielderrors.ValidationErrorList { token := obj.(*api.OAuthAuthorizeToken) return validation.ValidateAuthorizeToken(token) }