interface IUserSession
cangjie
public interface IUserSession功能:定义用户会话服务接口。
成员概览
| 成员 | 功能 |
|---|---|
| func getUser() | 获取当前登录用户主体。 |
| func signIn(IdentityUser, ?AuthenticationProperties) | 为指定用户创建登录会话。 |
| func signOut(?AuthenticationProperties) | 退出当前用户会话。 |
func getUser()
cangjie
func getUser(): ?ClaimsPrincipal功能:获取当前登录用户主体。
返回值:
- ?ClaimsPrincipal - 返回当前用户主体;未登录时返回空。
func signIn(IdentityUser, ?AuthenticationProperties)
cangjie
func signIn(user: IdentityUser, properties: ?AuthenticationProperties): Unit功能:为指定用户创建登录会话。
参数:
- user: IdentityUser - 需要登录的用户。
- properties: ?AuthenticationProperties - 认证属性。
返回值:
Unit
func signOut(?AuthenticationProperties)
cangjie
func signOut(properties: ?AuthenticationProperties): Unit功能:退出当前用户会话。
参数:
- properties: ?AuthenticationProperties - 认证属性。
返回值:
Unit