diff --git a/internal/domain/auth_request.go b/internal/domain/auth_request.go index 38363ff09a..8e0c031415 100644 --- a/internal/domain/auth_request.go +++ b/internal/domain/auth_request.go @@ -111,11 +111,11 @@ const ( ) func NewAuthRequestFromType(requestType AuthRequestType) (*AuthRequest, error) { - request, ok := authRequestTypeMapping[requestType] - if !ok { - return nil, errors.ThrowInvalidArgument(nil, "DOMAIN-ds2kl", "invalid request type") + switch requestType { + case AuthRequestTypeOIDC: + return &AuthRequest{Request: &AuthRequestOIDC{}}, nil } - return &AuthRequest{Request: request}, nil + return nil, errors.ThrowInvalidArgument(nil, "DOMAIN-ds2kl", "invalid request type") } func (a *AuthRequest) WithCurrentInfo(info *BrowserInfo) *AuthRequest { diff --git a/internal/domain/request.go b/internal/domain/request.go index b31d85fe57..c0bfd69bfd 100644 --- a/internal/domain/request.go +++ b/internal/domain/request.go @@ -15,12 +15,6 @@ type Request interface { type AuthRequestType int32 -var ( - authRequestTypeMapping = map[AuthRequestType]Request{ - AuthRequestTypeOIDC: &AuthRequestOIDC{}, - } -) - const ( AuthRequestTypeOIDC AuthRequestType = iota AuthRequestTypeSAML