Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fix OIDC address field #3013

Merged
merged 11 commits into from
Jun 25, 2024
Merged

feat: fix OIDC address field #3013

merged 11 commits into from
Jun 25, 2024

Conversation

Bsheepcoder
Copy link
Contributor

@Bsheepcoder Bsheepcoder commented Jun 19, 2024

Fix: #3001

OIDC : https://openid.net/specs/openid-connect-core-1_0-errata2.html#AddressClaim

I test with go-oidc,test result:
image

go-oidc key code:

type Address struct {
	Formatted     string `json:"formatted"`
	StreetAddress string `json:"street_address"`
	Locality      string `json:"locality"`
	Region        string `json:"region"`
	PostalCode    string `json:"postal_code"`
	Country       string `json:"country"`
}

type UserInfo struct {
	Sub     string  `json:"sub"`
	Name    string  `json:"name"`
	Email   string  `json:"email"`
	Picture string  `json:"picture"`
	Address Address `json:"address"`
}

var userInfo UserInfo
if err := idToken.Claims(&userInfo); err != nil {
	http.Error(w, "Failed to parse claims", http.StatusInternalServerError)
	return
}

// Output user info as JSON
data, err := json.MarshalIndent(userInfo, "", "  ")
w.Header().Set("Content-Type", "application/json")
w.Write(data)

@casbin-bot
Copy link
Contributor

@tangyang9464 @imp2002 please review

object/user.go Outdated Show resolved Hide resolved
@hsluoyz hsluoyz requested a review from dacongda June 24, 2024 16:13
@hsluoyz
Copy link
Member

hsluoyz commented Jun 24, 2024

@dacongda plz review

@hsluoyz hsluoyz changed the title feat: add several fields related to the OIDC specification address feat: fix OIDC address field Jun 25, 2024
@hsluoyz hsluoyz merged commit 2f48d45 into casdoor:master Jun 25, 2024
8 checks passed
@casbin-bot
Copy link
Contributor

🎉 This PR is included in version 1.632.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@hsluoyz
Copy link
Member

hsluoyz commented Jun 25, 2024

Reverted due to severe bug

@savely-krasovsky
Copy link

Are there any plans to fix it again properly? Cannot integrate with PhotoPrism due to this bug.

@dacongda
Copy link
Contributor

dacongda commented Jul 9, 2024

Are there any plans to fix it again properly? Cannot integrate with PhotoPrism due to this bug.

Set the application's JWT type to JWT-Empty might temporarily solve your problem, if it work or not, please reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] fix the address issue for OIDC
5 participants