mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Add organization and user to token.
This commit is contained in:
parent
6095af0512
commit
fffada894c
@ -31,7 +31,9 @@ type Token struct {
|
||||
Name string `xorm:"varchar(100) notnull pk" json:"name"`
|
||||
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
|
||||
|
||||
Application string `xorm:"varchar(100)" json:"application"`
|
||||
Application string `xorm:"varchar(100)" json:"application"`
|
||||
Organization string `xorm:"varchar(100)" json:"organization"`
|
||||
User string `xorm:"varchar(100)" json:"user"`
|
||||
|
||||
Code string `xorm:"varchar(100)" json:"code"`
|
||||
AccessToken string `xorm:"mediumtext" json:"accessToken"`
|
||||
@ -169,15 +171,17 @@ func GetOAuthCode(userId string, clientId string, responseType string, redirectU
|
||||
}
|
||||
|
||||
token := &Token{
|
||||
Owner: application.Owner,
|
||||
Name: util.GenerateId(),
|
||||
CreatedTime: util.GetCurrentTime(),
|
||||
Application: application.Name,
|
||||
Code: util.GenerateClientId(),
|
||||
AccessToken: accessToken,
|
||||
ExpiresIn: application.ExpireInHours * 60,
|
||||
Scope: scope,
|
||||
TokenType: "Bearer",
|
||||
Owner: application.Owner,
|
||||
Name: util.GenerateId(),
|
||||
CreatedTime: util.GetCurrentTime(),
|
||||
Application: application.Name,
|
||||
Organization: user.Owner,
|
||||
User: user.Name,
|
||||
Code: util.GenerateClientId(),
|
||||
AccessToken: accessToken,
|
||||
ExpiresIn: application.ExpireInHours * 60,
|
||||
Scope: scope,
|
||||
TokenType: "Bearer",
|
||||
}
|
||||
AddToken(token)
|
||||
|
||||
|
@ -124,6 +124,34 @@ class TokenListPage extends React.Component {
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: i18next.t("token:Organization"),
|
||||
dataIndex: 'organization',
|
||||
key: 'organization',
|
||||
width: '120px',
|
||||
sorter: (a, b) => a.organization.localeCompare(b.organization),
|
||||
render: (text, record, index) => {
|
||||
return (
|
||||
<Link to={`/organizations/${text}`}>
|
||||
{text}
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: i18next.t("token:User"),
|
||||
dataIndex: 'user',
|
||||
key: 'user',
|
||||
width: '120px',
|
||||
sorter: (a, b) => a.user.localeCompare(b.user),
|
||||
render: (text, record, index) => {
|
||||
return (
|
||||
<Link to={`/users/${record.organization}/${text}`}>
|
||||
{text}
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: i18next.t("token:Authorization code"),
|
||||
dataIndex: 'code',
|
||||
@ -159,13 +187,13 @@ class TokenListPage extends React.Component {
|
||||
width: '100px',
|
||||
sorter: (a, b) => a.scope.localeCompare(b.scope),
|
||||
},
|
||||
{
|
||||
title: i18next.t("token:Token type"),
|
||||
dataIndex: 'tokenType',
|
||||
key: 'tokenType',
|
||||
width: '130px',
|
||||
sorter: (a, b) => a.tokenType.localeCompare(b.tokenType),
|
||||
},
|
||||
// {
|
||||
// title: i18next.t("token:Token type"),
|
||||
// dataIndex: 'tokenType',
|
||||
// key: 'tokenType',
|
||||
// width: '130px',
|
||||
// sorter: (a, b) => a.tokenType.localeCompare(b.tokenType),
|
||||
// },
|
||||
{
|
||||
title: i18next.t("general:Action"),
|
||||
dataIndex: '',
|
||||
|
Loading…
x
Reference in New Issue
Block a user