Skip to content

Commit 82fe732

Browse files
committed
Remove fake email scope value
1 parent db72236 commit 82fe732

File tree

8 files changed

+4
-42
lines changed

8 files changed

+4
-42
lines changed

docs/v3-api.yaml

-6
Original file line numberDiff line numberDiff line change
@@ -5289,12 +5289,6 @@ components:
52895289
description: 更新日時
52905290
traq:
52915291
$ref: '#/components/schemas/OIDCTraqUserInfo'
5292-
email:
5293-
type: string
5294-
description: メールアドレス (フェイク値)
5295-
email_verified:
5296-
type: boolean
5297-
description: メールアドレスの確認が取れているか (フェイク値)
52985292
required:
52995293
- sub
53005294
OIDCTraqUserInfo:

migration/current.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func Migrations() []*gormigrate.Migration {
4545
v32(), // ユーザーの表示名上限を32文字に
4646
v33(), // 未読テーブルにチャンネルIDカラムを追加 / インデックス類の更新 / 不要なレコードの削除
4747
v34(), // 未読テーブルのcreated_atカラムをメッセージテーブルを元に更新 / カラム名を変更
48-
v35(), // OIDC実装のため、openid, profile, emailロール、get_oidc_userinfo権限を追加
48+
v35(), // OIDC実装のため、openid, profileロール、get_oidc_userinfo権限を追加
4949
}
5050
}
5151

migration/v35.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"gorm.io/gorm"
66
)
77

8-
// v35 OIDC実装のため、openid, profile, emailロール、get_oidc_userinfo権限を追加
8+
// v35 OIDC実装のため、openid, profileロール、get_oidc_userinfo権限を追加
99
func v35() *gormigrate.Migration {
1010
return &gormigrate.Migration{
1111
ID: "35",
@@ -28,17 +28,6 @@ func v35() *gormigrate.Migration {
2828
},
2929
},
3030
},
31-
{
32-
Name: "email",
33-
Oauth2Scope: true,
34-
System: true,
35-
Permissions: []v35RolePermission{
36-
{
37-
Role: "profile",
38-
Permission: "get_oidc_userinfo",
39-
},
40-
},
41-
},
4231
}
4332
for _, role := range roles {
4433
err := db.Create(&role).Error

model/oauth2.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type AccessScopes map[AccessScope]struct{}
3131

3232
// SupportedAccessScopes 対応するスコープ一覧を返します
3333
func SupportedAccessScopes() []string {
34-
return []string{"read", "write", "manage_bot", "openid", "profile", "email"}
34+
return []string{"read", "write", "manage_bot", "openid", "profile"}
3535
}
3636

3737
// Value database/sql/driver.Valuer 実装

router/oauth2/token_endpoint.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (h *Handler) issueIDToken(client *model.OAuth2Client, token *model.OAuth2To
5959
"exp": token.Deadline().Unix(),
6060
"iat": token.CreatedAt.Unix(),
6161
}
62-
// Extra claims according to scopes (profile, email)
62+
// Extra claims according to scopes (profile)
6363
userInfo, err := h.OIDC.GetUserInfo(userID, token.Scopes)
6464
if err != nil {
6565
return "", err

service/oidc/userinfo.go

-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ func (s *Service) GetUserInfo(userID uuid.UUID, scopes ScopeChecker) (map[string
7171
"home_channel": user.GetHomeChannel(),
7272
}
7373
}
74-
if scopes.Contains("email") {
75-
claims["email"] = user.GetName() + "@example.com"
76-
claims["email_verified"] = false
77-
}
7874

7975
return claims, nil
8076
}

service/rbac/role/email.go

-12
This file was deleted.

service/rbac/role/role.go

-5
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ func GetSystemRoles() Roles {
4848
oauth2Scope: true,
4949
permissions: permission.PermissionsFromArray(profilePerms),
5050
},
51-
Email: &systemRole{
52-
name: Email,
53-
oauth2Scope: true,
54-
permissions: permission.PermissionsFromArray(emailPerms),
55-
},
5651
}
5752
}
5853

0 commit comments

Comments
 (0)