OIDC non ascii username login problem
Created by: supu2
General remarks
This form is to report bugs. For general usage questions refer to our Slack channel KubeSphere-users
Describe the bug Enable auht oidc with keycloak, i encountered some user login issue like below. After sso login user faced empty page with status code 500. Some research over github i found same problem. Problem is sso return non ascii username like "Škoda" to console server . We need to replace non ascii char in user.extraname like this.
ctx.cookies.set('defaultUser', user.extraname.replace(/([^\x00-\xFF]|\s)/g,''))
<-- GET /oauth/redirect/sso?state=sso&session_state=31c552f9-dxxx 2021/08/24T14:55:50.403
TypeError: argument value is invalid
at new Cookie (/opt/kubesphere/console/server/server.js:20401:11)
at Cookies.set (/opt/kubesphere/console/server/server.js:20363:16)
at handleOAuthLogin (/opt/kubesphere/console/server/server.js:66532:17)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async /opt/kubesphere/console/server/server.js:36632:7
at async logger (/opt/kubesphere/console/server/server.js:33653:7)
at async /opt/kubesphere/console/server/server.js:28416:26
at async /opt/kubesphere/console/server/server.js:28416:26
at async /opt/kubesphere/console/server/server.js:28416:26
Versions used(KubeSphere/Kubernetes) KubeSphere: v.3.1.1-dirty Kubernetes: 1.8.9
Expected behavior A clear and concise description of what you expected to happen.