Skip to content

Commit 7c2693b

Browse files
committed
fix: form post template
1 parent eaa10ec commit 7c2693b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

server/handlers/authorize.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func AuthorizeHandler() gin.HandlerFunc {
8686

8787
loginError := map[string]interface{}{
8888
"type": "authorization_response",
89-
"response": map[string]string{
89+
"response": map[string]interface{}{
9090
"error": "login_required",
9191
"error_description": "Login is required",
9292
},
@@ -113,7 +113,7 @@ func AuthorizeHandler() gin.HandlerFunc {
113113
log.Debug("GetUserByID failed: ", err)
114114
handleResponse(gc, responseMode, loginURL, redirectURI, map[string]interface{}{
115115
"type": "authorization_response",
116-
"response": map[string]string{
116+
"response": map[string]interface{}{
117117
"error": "signup_required",
118118
"error_description": "Sign up required",
119119
},
@@ -181,7 +181,7 @@ func AuthorizeHandler() gin.HandlerFunc {
181181

182182
handleResponse(gc, responseMode, loginURL, redirectURI, map[string]interface{}{
183183
"type": "authorization_response",
184-
"response": map[string]string{
184+
"response": map[string]interface{}{
185185
"code": code,
186186
"state": state,
187187
},
@@ -287,7 +287,7 @@ func validateAuthorizeRequest(responseType, responseMode, clientID, state, codeC
287287

288288
func handleResponse(gc *gin.Context, responseMode, loginURI, redirectURI string, data map[string]interface{}, httpStatusCode int) {
289289
isAuthenticationRequired := false
290-
if _, ok := data["response"].(map[string]string)["error"]; ok {
290+
if _, ok := data["response"].(map[string]interface{})["error"]; ok {
291291
isAuthenticationRequired = true
292292
}
293293

@@ -308,7 +308,7 @@ func handleResponse(gc *gin.Context, responseMode, loginURI, redirectURI string,
308308
case constants.ResponseModeFormPost:
309309
gc.HTML(httpStatusCode, authorizeFormPostTemplate, gin.H{
310310
"target_origin": redirectURI,
311-
"authorization_response": data,
311+
"authorization_response": data["response"],
312312
})
313313
return
314314
}

templates/authorize_form_post.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<title>Authorization Response</title>
55
</head>
66
<body onload="document.forms['authorize_form_post'].submit()">
7-
<form action={{.target_origin}} name="authorize_form_post">
7+
<form action="{{.target_origin}}" name="authorize_form_post" method="POST">
88
{{ range $key, $val := .authorization_response }}
9-
<input type="hidden" key={{$key}} value={{$val}} name={{$key}} id={{$key}} />
9+
<input type="hidden" key="{{$key}}" value="{{$val}}" name="{{$key}}" id="{{$key}}" />
1010
{{ end }}
1111
</form>
1212
</body>

0 commit comments

Comments
 (0)