78 lines
1.0 KiB
Go
Executable File
78 lines
1.0 KiB
Go
Executable File
package usecase
|
|
|
|
type TokenClaims map[string]string
|
|
|
|
func (tc TokenClaims) SetID(id string) {
|
|
tc["id"] = id
|
|
}
|
|
|
|
func (tc TokenClaims) SetRole(role string) {
|
|
tc["role"] = role
|
|
}
|
|
|
|
func (tc TokenClaims) SetDeviceID(deviceID string) {
|
|
tc["device_id"] = deviceID
|
|
}
|
|
|
|
func (tc TokenClaims) SetScope(scope string) {
|
|
tc["scope"] = scope
|
|
}
|
|
|
|
func (tc TokenClaims) SetLoginID(loginID string) {
|
|
tc["login_id"] = loginID
|
|
}
|
|
|
|
func (tc TokenClaims) Role() string {
|
|
role, ok := tc["role"]
|
|
if !ok {
|
|
return ""
|
|
}
|
|
|
|
return role
|
|
}
|
|
|
|
func (tc TokenClaims) ID() string {
|
|
id, ok := tc["id"]
|
|
if !ok {
|
|
return ""
|
|
}
|
|
|
|
return id
|
|
}
|
|
|
|
func (tc TokenClaims) DeviceID() string {
|
|
deviceID, ok := tc["device_id"]
|
|
if !ok {
|
|
return ""
|
|
}
|
|
|
|
return deviceID
|
|
}
|
|
|
|
func (tc TokenClaims) UID() string {
|
|
uid, ok := tc["uid"]
|
|
if !ok {
|
|
return ""
|
|
}
|
|
|
|
return uid
|
|
}
|
|
|
|
func (tc TokenClaims) Scope() string {
|
|
scope, ok := tc["scope"]
|
|
if !ok {
|
|
return ""
|
|
}
|
|
|
|
return scope
|
|
}
|
|
|
|
func (tc TokenClaims) LoginID() string {
|
|
scope, ok := tc["login_id"]
|
|
if !ok {
|
|
return ""
|
|
}
|
|
|
|
return scope
|
|
}
|