Files
baiyue-firstleg/common-security/src/main/java/com/baiyue/common/security/AuthenticatedUser.java
T

27 lines
1.1 KiB
Java
Raw Normal View History

2026-07-30 18:01:36 +08:00
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,
2026-08-08 09:17:42 +08:00
Set<String> permissions, boolean impersonated, Long actorUserId,
Long actorMembershipId, boolean passwordChangeRequired) implements Principal {
public AuthenticatedUser(Long userId, Long tenantId, Long operatorTenantId, Long membershipId,
String username, String appCode, String clientType, Set<String> permissions) {
this(userId, tenantId, operatorTenantId, membershipId, username, appCode, clientType,
permissions, false, null, null, false);
}
2026-07-30 18:01:36 +08:00
public AuthenticatedUser {
permissions = permissions == null ? Set.of() : Set.copyOf(permissions);
}
@Override
public String getName() {
return username;
}
}