Skip to content

class IdentityResource

cangjie
public class IdentityResource <: ResourceBase & IScope & Serializable<IdentityResource>

功能:表示 OpenID Connect 身份资源定义。

父类型:

成员概览

成员功能
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 - 身份资源对应的数据模型。

返回值:

异常:

  • DataModelException - 当数据模型不是结构类型时抛出。