@@ -137,20 +137,34 @@ func AuthorizeHandler() gin.HandlerFunc {
137137
138138 // in case, response type is code and user is already logged in send the code and state
139139 // and cookie session will already be rolled over and set
140- gc .HTML (http .StatusOK , authorizeWebMessageTemplate , gin.H {
141- "target_origin" : redirectURI ,
142- "authorization_response" : map [string ]interface {}{
143- "type" : "authorization_response" ,
144- "response" : map [string ]string {
145- "code" : code ,
146- "state" : state ,
140+ if responseMode == constants .ResponseModeFormPost {
141+ gc .HTML (http .StatusOK , authorizeFormPostTemplate , gin.H {
142+ "target_origin" : redirectURI ,
143+ "authorization_response" : map [string ]interface {}{
144+ "type" : "authorization_response" ,
145+ "response" : map [string ]string {
146+ "code" : code ,
147+ "state" : state ,
148+ },
147149 },
148- },
149- })
150+ })
151+ } else {
152+ gc .HTML (http .StatusOK , authorizeWebMessageTemplate , gin.H {
153+ "target_origin" : redirectURI ,
154+ "authorization_response" : map [string ]interface {}{
155+ "type" : "authorization_response" ,
156+ "response" : map [string ]string {
157+ "code" : code ,
158+ "state" : state ,
159+ },
160+ },
161+ })
162+ }
163+
150164 return
151165 }
152166
153- if responseType == constants .ResponseTypeToken {
167+ if responseType == constants .ResponseTypeToken || responseType == constants . ResponseTypeIDToken {
154168 // rollover the session for security
155169 authToken , err := token .CreateAuthToken (gc , user , claims .Roles , scope , claims .LoginMethod )
156170 if err != nil {
@@ -222,7 +236,7 @@ func AuthorizeHandler() gin.HandlerFunc {
222236}
223237
224238func validateAuthorizeRequest (responseType , responseMode , clientID , state , codeChallenge string ) error {
225- if responseType != constants .ResponseTypeCode && responseType != constants .ResponseTypeToken {
239+ if responseType != constants .ResponseTypeCode && responseType != constants .ResponseTypeToken && responseType != constants . ResponseTypeIDToken {
226240 return fmt .Errorf ("invalid response type %s. 'code' & 'token' are valid response_type" , responseMode )
227241 }
228242
0 commit comments