Skip to content

Commit 0feee51

Browse files
committed
fix: Oauth callback url is fixed to host+/api/oidc/callback (#314)
1 parent 65f0a9e commit 0feee51

File tree

9 files changed

+44
-40
lines changed

9 files changed

+44
-40
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494
- 对于`OIDC`, `Issuer`是必须的。`Scopes`是可选的,默认为 `openid,profile,email`. 确保可以获取 `sub`,`email``preferred_username`
9595
- `github oauth app``Settings`->`Developer settings`->`OAuth Apps`->`New OAuth App`
9696
中创建,地址 [https://github.com/settings/developers](https://github.com/settings/developers)
97-
- `Authorization callback URL`填写`http://<your server[:port]>/api/oauth/callback`
98-
,比如`http://127.0.0.1:21114/api/oauth/callback`
97+
- `Authorization callback URL`填写`http://<your server[:port]>/api/oidc/callback`
98+
,比如`http://127.0.0.1:21114/api/oidc/callback`
9999
7. 登录日志
100100
8. 链接日志
101101
9. 文件传输日志

README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ displaying data.Frontend code is available at [rustdesk-api-web](https://github.
9494
- For `OIDC`, you must set the `Issuer`. And `Scopes` is optional which default is `openid,email,profile`, please make sure this `Oauth App` can access `sub`, `email` and `preferred_username`
9595
- Create a `GitHub OAuth App`
9696
at `Settings` -> `Developer settings` -> `OAuth Apps` -> `New OAuth App` [here](https://github.com/settings/developers).
97-
- Set the `Authorization callback URL` to `http://<your server[:port]>/api/oauth/callback`,
98-
e.g., `http://127.0.0.1:21114/api/oauth/callback`.
97+
- Set the `Authorization callback URL` to `http://<your server[:port]>/api/oidc/callback`,
98+
e.g., `http://127.0.0.1:21114/api/oidc/callback`.
9999

100100
7. Login logs
101101
8. Connection logs

docs/api/api_docs.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -954,9 +954,9 @@ const docTemplateapi = `{
954954
}
955955
}
956956
},
957-
"/oauth/callback": {
958-
"get": {
959-
"description": "OauthCallback",
957+
"/oidc/auth": {
958+
"post": {
959+
"description": "OidcAuth",
960960
"consumes": [
961961
"application/json"
962962
],
@@ -966,7 +966,7 @@ const docTemplateapi = `{
966966
"tags": [
967967
"Oauth"
968968
],
969-
"summary": "OauthCallback",
969+
"summary": "OidcAuth",
970970
"responses": {
971971
"200": {
972972
"description": "OK",
@@ -983,9 +983,9 @@ const docTemplateapi = `{
983983
}
984984
}
985985
},
986-
"/oidc/auth": {
987-
"post": {
988-
"description": "OidcAuth",
986+
"/oidc/auth-query": {
987+
"get": {
988+
"description": "OidcAuthQuery",
989989
"consumes": [
990990
"application/json"
991991
],
@@ -995,7 +995,7 @@ const docTemplateapi = `{
995995
"tags": [
996996
"Oauth"
997997
],
998-
"summary": "OidcAuth",
998+
"summary": "OidcAuthQuery",
999999
"responses": {
10001000
"200": {
10011001
"description": "OK",
@@ -1012,9 +1012,9 @@ const docTemplateapi = `{
10121012
}
10131013
}
10141014
},
1015-
"/oidc/auth-query": {
1015+
"/oidc/callback": {
10161016
"get": {
1017-
"description": "OidcAuthQuery",
1017+
"description": "OauthCallback",
10181018
"consumes": [
10191019
"application/json"
10201020
],
@@ -1024,7 +1024,7 @@ const docTemplateapi = `{
10241024
"tags": [
10251025
"Oauth"
10261026
],
1027-
"summary": "OidcAuthQuery",
1027+
"summary": "OauthCallback",
10281028
"responses": {
10291029
"200": {
10301030
"description": "OK",

docs/api/api_swagger.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -947,9 +947,9 @@
947947
}
948948
}
949949
},
950-
"/oauth/callback": {
951-
"get": {
952-
"description": "OauthCallback",
950+
"/oidc/auth": {
951+
"post": {
952+
"description": "OidcAuth",
953953
"consumes": [
954954
"application/json"
955955
],
@@ -959,7 +959,7 @@
959959
"tags": [
960960
"Oauth"
961961
],
962-
"summary": "OauthCallback",
962+
"summary": "OidcAuth",
963963
"responses": {
964964
"200": {
965965
"description": "OK",
@@ -976,9 +976,9 @@
976976
}
977977
}
978978
},
979-
"/oidc/auth": {
980-
"post": {
981-
"description": "OidcAuth",
979+
"/oidc/auth-query": {
980+
"get": {
981+
"description": "OidcAuthQuery",
982982
"consumes": [
983983
"application/json"
984984
],
@@ -988,7 +988,7 @@
988988
"tags": [
989989
"Oauth"
990990
],
991-
"summary": "OidcAuth",
991+
"summary": "OidcAuthQuery",
992992
"responses": {
993993
"200": {
994994
"description": "OK",
@@ -1005,9 +1005,9 @@
10051005
}
10061006
}
10071007
},
1008-
"/oidc/auth-query": {
1008+
"/oidc/callback": {
10091009
"get": {
1010-
"description": "OidcAuthQuery",
1010+
"description": "OauthCallback",
10111011
"consumes": [
10121012
"application/json"
10131013
],
@@ -1017,7 +1017,7 @@
10171017
"tags": [
10181018
"Oauth"
10191019
],
1020-
"summary": "OidcAuthQuery",
1020+
"summary": "OauthCallback",
10211021
"responses": {
10221022
"200": {
10231023
"description": "OK",

docs/api/api_swagger.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -792,11 +792,11 @@ paths:
792792
summary: 登出
793793
tags:
794794
- 登录
795-
/oauth/callback:
796-
get:
795+
/oidc/auth:
796+
post:
797797
consumes:
798798
- application/json
799-
description: OauthCallback
799+
description: OidcAuth
800800
produces:
801801
- application/json
802802
responses:
@@ -808,14 +808,14 @@ paths:
808808
description: Internal Server Error
809809
schema:
810810
$ref: '#/definitions/response.ErrorResponse'
811-
summary: OauthCallback
811+
summary: OidcAuth
812812
tags:
813813
- Oauth
814-
/oidc/auth:
815-
post:
814+
/oidc/auth-query:
815+
get:
816816
consumes:
817817
- application/json
818-
description: OidcAuth
818+
description: OidcAuthQuery
819819
produces:
820820
- application/json
821821
responses:
@@ -827,14 +827,14 @@ paths:
827827
description: Internal Server Error
828828
schema:
829829
$ref: '#/definitions/response.ErrorResponse'
830-
summary: OidcAuth
830+
summary: OidcAuthQuery
831831
tags:
832832
- Oauth
833-
/oidc/auth-query:
833+
/oidc/callback:
834834
get:
835835
consumes:
836836
- application/json
837-
description: OidcAuthQuery
837+
description: OauthCallback
838838
produces:
839839
- application/json
840840
responses:
@@ -846,7 +846,7 @@ paths:
846846
description: Internal Server Error
847847
schema:
848848
$ref: '#/definitions/response.ErrorResponse'
849-
summary: OidcAuthQuery
849+
summary: OauthCallback
850850
tags:
851851
- Oauth
852852
/peers:

http/controller/api/ouath.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (o *Oauth) OidcAuthQuery(c *gin.Context) {
143143
// @Produce json
144144
// @Success 200 {object} apiResp.LoginRes
145145
// @Failure 500 {object} response.ErrorResponse
146-
// @Router /oauth/callback [get]
146+
// @Router /oidc/callback [get]
147147
func (o *Oauth) OauthCallback(c *gin.Context) {
148148
state := c.Query("state")
149149
if state == "" {

http/router/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ func ApiInit(g *gin.Engine) {
4949
frg.GET("/oauth/callback", o.OauthCallback)
5050
frg.GET("/oauth/login", o.OauthCallback)
5151
frg.GET("/oauth/msg", o.Message)
52+
53+
frg.GET("/oidc/callback", o.OauthCallback)
54+
frg.GET("/oidc/login", o.OauthCallback)
55+
frg.GET("/oidc/msg", o.Message)
5256
}
5357
{
5458
pe := &api.Peer{}

resources/templates/oauth_fail.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
var title = 'OauthFailed'
6363
var msg = '{{.message}}'
6464
var btn = 'Close'
65-
document.writeln('<script src="/api/oauth/msg?lang=' + lang + '&msg=' + msg + '&title=OauthFailed"><\/script>');
65+
document.writeln('<script src="/api/oidc/msg?lang=' + lang + '&msg=' + msg + '&title=OauthFailed"><\/script>');
6666
</script>
6767
</head>
6868
<body>

resources/templates/oauth_success.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
var title = 'OauthSuccess'
6262
var msg = '{{.message}}'
6363
var btn = 'Close'
64-
document.writeln('<script src="/api/oauth/msg?lang=' + lang + '&msg=' + msg + '&title=OauthSuccess"><\/script>');
64+
document.writeln('<script src="/api/oidc/msg?lang=' + lang + '&msg=' + msg + '&title=OauthSuccess"><\/script>');
6565
</script>
6666
</head>
6767
<body>

0 commit comments

Comments
 (0)