From 96722e3e6660a1ed0187be8b3a7856a57d5893db Mon Sep 17 00:00:00 2001
From: zachmann <gabriel.zachmann@kit.edu>
Date: Tue, 9 Nov 2021 10:12:34 +0100
Subject: [PATCH] change default redirect type in auth code grant type to
 'native'

---
 internal/endpoints/token/mytoken/pkg/authCodeFlowRequest.go | 2 +-
 internal/endpoints/token/mytoken/pkg/oidcFlowRequest.go     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/internal/endpoints/token/mytoken/pkg/authCodeFlowRequest.go b/internal/endpoints/token/mytoken/pkg/authCodeFlowRequest.go
index af8a677d..e3f0a191 100644
--- a/internal/endpoints/token/mytoken/pkg/authCodeFlowRequest.go
+++ b/internal/endpoints/token/mytoken/pkg/authCodeFlowRequest.go
@@ -15,7 +15,7 @@ type AuthCodeFlowRequest struct {
 
 // Native checks if the request is native
 func (r *AuthCodeFlowRequest) Native() bool {
-	return r.RedirectType == api.RedirectTypeNative
+	return r.RedirectType != api.RedirectTypeWeb
 }
 
 // UnmarshalJSON implements the json unmarshaler interface
diff --git a/internal/endpoints/token/mytoken/pkg/oidcFlowRequest.go b/internal/endpoints/token/mytoken/pkg/oidcFlowRequest.go
index 3d590966..6299b626 100644
--- a/internal/endpoints/token/mytoken/pkg/oidcFlowRequest.go
+++ b/internal/endpoints/token/mytoken/pkg/oidcFlowRequest.go
@@ -30,7 +30,7 @@ func NewOIDCFlowRequest() *OIDCFlowRequest {
 			},
 		},
 		ResponseType: model.ResponseTypeToken,
-		redirectType: api.RedirectTypeWeb,
+		redirectType: api.RedirectTypeNative,
 		GrantType:    -1,
 	}
 }
-- 
GitLab