[GH-ISSUE #584] casdoor登录报错 #3395

Closed
opened 2026-02-28 11:55:54 +03:00 by kerem · 11 comments
Owner

Originally created by @chung1912 on GitHub (Sep 27, 2024).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/584

2024-09-27 18:32:45 ERROR user/casdoor.go:52 json: cannot unmarshal object into Go struct field Claims.address of type []string
日志出现这个错误,怎么解决?
另外,环境变量NGINX_UI_CASDOOR_CERTIFICATE的值直接输入证书字符串也太长了,能不能支持读pem文件?直接映射这个文件来读取更方便些

Originally created by @chung1912 on GitHub (Sep 27, 2024). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/584 2024-09-27 18:32:45 ERROR user/casdoor.go:52 json: cannot unmarshal object into Go struct field Claims.address of type []string 日志出现这个错误,怎么解决? 另外,环境变量NGINX_UI_CASDOOR_CERTIFICATE的值直接输入证书字符串也太长了,能不能支持读pem文件?直接映射这个文件来读取更方便些
kerem 2026-02-28 11:55:54 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@0xJacky commented on GitHub (Sep 28, 2024):

参考一下这个配置:https://github.com/0xJacky/nginx-ui/issues/423#issuecomment-2254904566

<!-- gh-comment-id:2380383684 --> @0xJacky commented on GitHub (Sep 28, 2024): 参考一下这个配置:https://github.com/0xJacky/nginx-ui/issues/423#issuecomment-2254904566
Author
Owner

@chung1912 commented on GitHub (Sep 28, 2024):

参考一下这个配置:#423 (comment)

我参考你这个配置的,帮忙看下是否有问题呢?docker-compose部署(证书太占地方了,我把证书处理成了一行,删除了换行符),可以正常跳转到casdoor,也能正常返回到login页面,但是会弹出如下错误提示:
ERROR user/casdoor.go:52 invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key
image

image

image

<!-- gh-comment-id:2380556290 --> @chung1912 commented on GitHub (Sep 28, 2024): > 参考一下这个配置:[#423 (comment)](https://github.com/0xJacky/nginx-ui/issues/423#issuecomment-2254904566) 我参考你这个配置的,帮忙看下是否有问题呢?docker-compose部署(证书太占地方了,我把证书处理成了一行,删除了换行符),可以正常跳转到casdoor,也能正常返回到login页面,但是会弹出如下错误提示: `ERROR user/casdoor.go:52 invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key` ![image](https://github.com/user-attachments/assets/d7f0b4cc-4573-4599-8b25-03d5303a5ef7) ![image](https://github.com/user-attachments/assets/58b5fad8-4fd4-4eaf-8f63-cd174c261b1a) ![image](https://github.com/user-attachments/assets/fec5764e-d247-4e5f-a4e4-eab3034a2bf1)
Author
Owner

@0xJacky commented on GitHub (Sep 30, 2024):

换行符不能删的吧...,你可以映射配置文件进入容器,不一定用环境变量

<!-- gh-comment-id:2382245754 --> @0xJacky commented on GitHub (Sep 30, 2024): 换行符不能删的吧...,你可以映射配置文件进入容器,不一定用环境变量
Author
Owner

@chung1912 commented on GitHub (Sep 30, 2024):

换行符不能删的吧...,你可以映射配置文件进入容器,不一定用环境变量

保留换行符,问题依旧

<!-- gh-comment-id:2382696775 --> @chung1912 commented on GitHub (Sep 30, 2024): > 换行符不能删的吧...,你可以映射配置文件进入容器,不一定用环境变量 保留换行符,问题依旧
Author
Owner

@0xJacky commented on GitHub (Oct 3, 2024):

花了点时间复现了一下,env 解析之后会把换行符替换为空格,所以证书就提示损坏了,这个问题是环境变量的锅,我计划在下个版本移除 app.ini 中直接配置证书内容的功能,改为在配置文件中设置证书的路径,到时候,可以直接把证书文件映射到容器内。

<!-- gh-comment-id:2391704313 --> @0xJacky commented on GitHub (Oct 3, 2024): 花了点时间复现了一下,env 解析之后会把换行符替换为空格,所以证书就提示损坏了,这个问题是环境变量的锅,我计划在下个版本移除 app.ini 中直接配置证书内容的功能,改为在配置文件中设置证书的路径,到时候,可以直接把证书文件映射到容器内。
Author
Owner

@0xJacky commented on GitHub (Oct 3, 2024):

临时的解决方案就是映射 app.ini 进容器,不使用 env

<!-- gh-comment-id:2391709096 --> @0xJacky commented on GitHub (Oct 3, 2024): 临时的解决方案就是映射 app.ini 进容器,不使用 env
Author
Owner

@chung1912 commented on GitHub (Oct 4, 2024):

花了点时间复现了一下,env 解析之后会把换行符替换为空格,所以证书就提示损坏了,这个问题是环境变量的锅,我计划在下个版本移除 app.ini 中直接配置证书内容的功能,改为在配置文件中设置证书的路径,到时候,可以直接把证书文件映射到容器内。

是的,直接改为映射下载下来的pem证书文件,这样配置也方便,也不会出错

<!-- gh-comment-id:2393892228 --> @chung1912 commented on GitHub (Oct 4, 2024): > 花了点时间复现了一下,env 解析之后会把换行符替换为空格,所以证书就提示损坏了,这个问题是环境变量的锅,我计划在下个版本移除 app.ini 中直接配置证书内容的功能,改为在配置文件中设置证书的路径,到时候,可以直接把证书文件映射到容器内。 是的,直接改为映射下载下来的pem证书文件,这样配置也方便,也不会出错
Author
Owner

@0xJacky commented on GitHub (Oct 6, 2024):

已修复,将会在 beta.36 中发布。

<!-- gh-comment-id:2395466558 --> @0xJacky commented on GitHub (Oct 6, 2024): 已修复,将会在 beta.36 中发布。
Author
Owner

@echoface commented on GitHub (Feb 9, 2025):

我这里报错 User not exist;

nginx_lan    | [0.146ms] [rows:0] SELECT * FROM `auths` WHERE `name` = "admin" AND `auths`.`deleted_at` IS NULL ORDER BY `auths`.`id` LIMIT 1

sso登录必须要求对应应用要注册一个admin的用户?

配置内容

[casdoor]
Endpoint        = https://casdoor.xxxxx.cn
ExternalUrl     = https://casdoor.xxxxx.cn
ClientId        = 2b686xxxxxx6d0
ClientSecret    = e4836e2e666fb86xxxxxxxx5b1209bf6e58914d
CertificatePath = /xxxxxx/xxxxxxx/xxxxx.pem
Organization    = xxorg
Application     = nginxlan
RedirectUri     = `https://nginx.echoface.cn/#/login`

@0xJacky @chung1912

<!-- gh-comment-id:2646303339 --> @echoface commented on GitHub (Feb 9, 2025): 我这里报错 User not exist; ``` nginx_lan | [0.146ms] [rows:0] SELECT * FROM `auths` WHERE `name` = "admin" AND `auths`.`deleted_at` IS NULL ORDER BY `auths`.`id` LIMIT 1 ``` sso登录必须要求对应应用要注册一个admin的用户? 配置内容 ``` [casdoor] Endpoint = https://casdoor.xxxxx.cn ExternalUrl = https://casdoor.xxxxx.cn ClientId = 2b686xxxxxx6d0 ClientSecret = e4836e2e666fb86xxxxxxxx5b1209bf6e58914d CertificatePath = /xxxxxx/xxxxxxx/xxxxx.pem Organization = xxorg Application = nginxlan RedirectUri = `https://nginx.echoface.cn/#/login` ``` @0xJacky @chung1912
Author
Owner

@0xJacky commented on GitHub (Feb 9, 2025):

我这里报错 User not exist;

nginx_lan    | [0.146ms] [rows:0] SELECT * FROM `auths` WHERE `name` = "admin" AND `auths`.`deleted_at` IS NULL ORDER BY `auths`.`id` LIMIT 1

sso登录必须要求对应应用要注册一个admin的用户?

配置内容

[casdoor]
Endpoint        = https://casdoor.xxxxx.cn
ExternalUrl     = https://casdoor.xxxxx.cn
ClientId        = 2b686xxxxxx6d0
ClientSecret    = e4836e2e666fb86xxxxxxxx5b1209bf6e58914d
CertificatePath = /xxxxxx/xxxxxxx/xxxxx.pem
Organization    = xxorg
Application     = nginxlan
RedirectUri     = `https://nginx.echoface.cn/#/login`

@0xJacky @chung1912

是的

<!-- gh-comment-id:2646309528 --> @0xJacky commented on GitHub (Feb 9, 2025): > 我这里报错 User not exist; > > ``` > nginx_lan | [0.146ms] [rows:0] SELECT * FROM `auths` WHERE `name` = "admin" AND `auths`.`deleted_at` IS NULL ORDER BY `auths`.`id` LIMIT 1 > ``` > > sso登录必须要求对应应用要注册一个admin的用户? > > 配置内容 > > ``` > [casdoor] > Endpoint = https://casdoor.xxxxx.cn > ExternalUrl = https://casdoor.xxxxx.cn > ClientId = 2b686xxxxxx6d0 > ClientSecret = e4836e2e666fb86xxxxxxxx5b1209bf6e58914d > CertificatePath = /xxxxxx/xxxxxxx/xxxxx.pem > Organization = xxorg > Application = nginxlan > RedirectUri = `https://nginx.echoface.cn/#/login` > ``` > > [@0xJacky](https://github.com/0xJacky) [@chung1912](https://github.com/chung1912) 是的
Author
Owner

@echoface commented on GitHub (Feb 10, 2025):

我这里报错 User not exist;

nginx_lan    | [0.146ms] [rows:0] SELECT * FROM `auths` WHERE `name` = "admin" AND `auths`.`deleted_at` IS NULL ORDER BY `auths`.`id` LIMIT 1

sso登录必须要求对应应用要注册一个admin的用户?
配置内容

[casdoor]
Endpoint        = https://casdoor.xxxxx.cn
ExternalUrl     = https://casdoor.xxxxx.cn
ClientId        = 2b686xxxxxx6d0
ClientSecret    = e4836e2e666fb86xxxxxxxx5b1209bf6e58914d
CertificatePath = /xxxxxx/xxxxxxx/xxxxx.pem
Organization    = xxorg
Application     = nginxlan
RedirectUri     = `https://nginx.echoface.cn/#/login`

@0xJacky @chung1912

是的

能否支持user 自动注册或者,配置中添加对应的配置项,比如allow_user_list 或者与casdoor交互的时候制定用户也行; 不然这个功能实现的比较奇怪; 和sso的实践规范相差很多

<!-- gh-comment-id:2647060829 --> @echoface commented on GitHub (Feb 10, 2025): > > 我这里报错 User not exist; > > ``` > > nginx_lan | [0.146ms] [rows:0] SELECT * FROM `auths` WHERE `name` = "admin" AND `auths`.`deleted_at` IS NULL ORDER BY `auths`.`id` LIMIT 1 > > ``` > > > > > > > > > > > > > > > > > > > > > > > > sso登录必须要求对应应用要注册一个admin的用户? > > 配置内容 > > ``` > > [casdoor] > > Endpoint = https://casdoor.xxxxx.cn > > ExternalUrl = https://casdoor.xxxxx.cn > > ClientId = 2b686xxxxxx6d0 > > ClientSecret = e4836e2e666fb86xxxxxxxx5b1209bf6e58914d > > CertificatePath = /xxxxxx/xxxxxxx/xxxxx.pem > > Organization = xxorg > > Application = nginxlan > > RedirectUri = `https://nginx.echoface.cn/#/login` > > ``` > > > > > > > > > > [@0xJacky](https://github.com/0xJacky) [@chung1912](https://github.com/chung1912) > > 是的 能否支持user 自动注册或者,配置中添加对应的配置项,比如allow_user_list 或者与casdoor交互的时候制定用户也行; 不然这个功能实现的比较奇怪; 和sso的实践规范相差很多
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#3395
No description provided.