class IdentityResource
cangjie
public class IdentityResource <: ResourceBase & IScope & Serializable<IdentityResource>功能:表示 OpenID Connect 身份资源定义。
父类型:
- ResourceBase
- IScope
- Serializable<IdentityResource>
成员概览
| 成员 | 功能 |
|---|---|
| init() | 创建空的身份资源实例。 |
| init(String, Array<String>) | 使用名称和声明类型创建身份资源。 |
| init(String, ?String) | 使用名称和描述创建身份资源。 |
| var required | 标识当前身份资源是否必须被显式授予。 |
| let OpenId | 表示标准 openid 身份资源。 |
| let Profile | 表示标准 profile 身份资源。 |
| let Email | 表示标准 email 身份资源。 |
| let Address | 表示标准 address 身份资源。 |
| func serialize() | 将当前身份资源序列化为数据模型。 |
| func deserialize(DataModel) | 从数据模型反序列化身份资源。 |
init()
cangjie
public init()功能:创建空的身份资源实例。
init(String, Array<String>)
cangjie
public init(name: String, claimTypes: Array<String>)功能:使用名称和声明类型创建身份资源。
参数:
- name:
String- 身份资源名称。 - claimTypes:
Array<String>- 关联的声明类型列表。
init(String, ?String)
cangjie
public init(name: String, description: ?String)功能:使用名称和描述创建身份资源。
参数:
- name:
String- 身份资源名称。 - description:
?String- 身份资源描述。
var required
cangjie
public var required = false功能:标识当前身份资源是否必须被显式授予。
let OpenId
cangjie
public static let OpenId = IdentityResource(OpenIdConnectScopes.OpenId, [ClaimTypes.Sub])功能:表示标准 openid 身份资源。
let Profile
cangjie
public static let Profile = IdentityResource(OpenIdConnectScopes.Profile, [ClaimTypes.Profile])功能:表示标准 profile 身份资源。
let Email
cangjie
public static let Email = IdentityResource(OpenIdConnectScopes.Email, [ClaimTypes.Email])功能:表示标准 email 身份资源。
let Address
cangjie
public static let Address = IdentityResource(OpenIdConnectScopes.Address, [ClaimTypes.Address])功能:表示标准 address 身份资源。
func serialize()
cangjie
public func serialize(): DataModelStruct功能:将当前身份资源序列化为数据模型。
返回值:
DataModelStruct- 返回身份资源对应的数据模型结构。
func deserialize(DataModel)
cangjie
public static func deserialize(dm: DataModel): IdentityResource功能:从数据模型反序列化身份资源。
参数:
- dm:
DataModel- 身份资源对应的数据模型。
返回值:
- IdentityResource - 返回反序列化后的身份资源。
异常:
DataModelException- 当数据模型不是结构类型时抛出。