Skip to content

Commit

Permalink
[auth] refactor: better variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
nanjiangshu committed Feb 13, 2025
1 parent 7f69b34 commit 726162f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sda/cmd/auth/frontend/templates/oidc.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="jumbotron" role="region">
<div class="container" id="loginbox1">
<p class="lead text-center">
Welcome, {{.Profile}}!
Welcome, {{.Fullname}}!
</p>
{{if .ResignedToken}}
<p class="text-center">
Expand Down
4 changes: 2 additions & 2 deletions sda/cmd/auth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (auth AuthHandler) elixirLogin(ctx iris.Context) *OIDCData {

return nil
}
err = auth.Config.DB.UpdateUserInfo(idStruct.User, idStruct.Profile, idStruct.Email, idStruct.EdupersonEntitlement)
err = auth.Config.DB.UpdateUserInfo(idStruct.User, idStruct.Fullname, idStruct.Email, idStruct.EdupersonEntitlement)
if err != nil {
log.Warn("Could not log user info.")
}
Expand Down Expand Up @@ -311,7 +311,7 @@ func (auth AuthHandler) getOIDCLogin(ctx iris.Context) {
ctx.ViewData("infoUrl", auth.Config.InfoURL)
ctx.ViewData("infoText", auth.Config.InfoText)
ctx.ViewData("User", oidcData.OIDCID.User)
ctx.ViewData("Profile", oidcData.OIDCID.Profile)
ctx.ViewData("Fullname", oidcData.OIDCID.Fullname)
ctx.ViewData("Passport", oidcData.OIDCID.Passport)
ctx.ViewData("RawToken", oidcData.OIDCID.RawToken)
ctx.ViewData("ResignedToken", oidcData.OIDCID.ResignedToken)
Expand Down
6 changes: 3 additions & 3 deletions sda/cmd/auth/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type OIDCIdentity struct {
Passport []string
RawToken string
ResignedToken string
Profile string
Fullname string
Email string
EdupersonEntitlement []string
ExpDateRaw string
Expand Down Expand Up @@ -94,7 +94,7 @@ func authenticateWithOidc(oauth2Config oauth2.Config, provider *oidc.Provider, c
// Extract custom passports, name and email claims
var claims struct {
PassportClaim []string `json:"ga4gh_passport_v1"`
ProfileClaim string `json:"name"`
FullnameClaim string `json:"name"`
EmailClaim string `json:"email"`
EdupersonEntitlement []string `json:"eduperson_entitlement"`
}
Expand All @@ -109,7 +109,7 @@ func authenticateWithOidc(oauth2Config oauth2.Config, provider *oidc.Provider, c
RawToken: rawAccessToken,
ResignedToken: rawAccessToken,
Passport: claims.PassportClaim,
Profile: claims.ProfileClaim,
Fullname: claims.FullnameClaim,
Email: claims.EmailClaim,
EdupersonEntitlement: claims.EdupersonEntitlement,
ExpDateRaw: rawExpDate,
Expand Down

0 comments on commit 726162f

Please sign in to comment.