22 lines
677 B
Java
22 lines
677 B
Java
package com.baiyue.common.security;
|
|||
|
|
|
||
|
|
import java.security.Principal;
|
||
|
|
import java.util.Set;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 统一认证用户主体,携带用户、租户、成员身份、应用端、客户端类型及权限信息。
|
||
|
|
*/
|
||
|
|
public record AuthenticatedUser(Long userId, Long tenantId, Long operatorTenantId, Long membershipId,
|
||
|
|
String username, String appCode, String clientType,
|
||
|
|
Set<String> permissions) implements Principal {
|
||
|
|
public AuthenticatedUser {
|
||
|
|
permissions = permissions == null ? Set.of() : Set.copyOf(permissions);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public String getName() {
|
||
|
|
return username;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|