JavaTM 2 Platform
Standard Ed. 6

java.security
类 IdentityScope

java.lang.Object
  继承者 java.security.Identity
      继承者 java.security.IdentityScope
所有已实现的接口:
Serializable, Principal

已过时。 此类不再被使用。其功能已经由 java.security.KeyStorejava.security.cert 包和 java.security.Principal 取代。

@Deprecated
public abstract class IdentityScope
extends Identity

此类表示身份的作用域。它本身也是 Identity,因此有名称和作用域。它也可以选择有一个公钥和关联的证书。

IdentityScope 可以包括各种类型的 Identity 对象,包括 Signer。所有类型的 Identity 对象都可以使用相同的方法获取、添加和删除。注意,对于在各种类型的 Identity 上的各种操作,不同类型的身份作用域将应用不同的策略,这是可能的,实际上也期望如此。

密钥和身份是一对一的映射关系,在每个作用域内一个密钥只能有一个副本。例如,假定 Acme Software, Inc 是用户已知的软件发行人。假定它是一个 Identity,也就是说,它有公钥和关联的证书集合。它在某个作用域内使用名称 "Acme Software" 命名。该作用域内没有其他指定 Identity 具有相同的公钥。当然,也没有相同的名称。

另请参见:
Identity, Signer, Principal, Key, 序列化表格

构造方法摘要
protected IdentityScope()
          已过时。 此构造方法只用于序列化,不能被子类使用。
  IdentityScope(String name)
          已过时。 构造具有指定名称的新身份作用域。
  IdentityScope(String name, IdentityScope scope)
          已过时。 构造具有指定名称和作用域的新身份作用域。
 
方法摘要
abstract  void addIdentity(Identity identity)
          已过时。 向此身份作用域添加一个身份。
 Identity getIdentity(Principal principal)
          已过时。 获取名称与指定的主体相同的身份。
abstract  Identity getIdentity(PublicKey key)
          已过时。 获取具有指定公钥的身份。
abstract  Identity getIdentity(String name)
          已过时。 返回此作用域内具有指定名称的身份(如果有的话)。
static IdentityScope getSystemScope()
          已过时。 返回系统的身份作用域。
abstract  Enumeration<Identity> identities()
          已过时。 返回此身份作用域内所有身份的枚举。
abstract  void removeIdentity(Identity identity)
          已过时。 从此身份作用作用域移除一个身份。
protected static void setSystemScope(IdentityScope scope)
          已过时。 设置系统的身份作用域。
abstract  int size()
          已过时。 返回此身份作用域内身份的数目。
 String toString()
          已过时。 返回此身份作用域的字符串表示形式,包括其名称、作用域名称和此身份作用域中身份的数目。
 
从类 java.security.Identity 继承的方法
addCertificate, certificates, equals, getInfo, getName, getPublicKey, getScope, hashCode, identityEquals, removeCertificate, setInfo, setPublicKey, toString
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

IdentityScope

protected IdentityScope()
已过时。 
此构造方法只用于序列化,不能被子类使用。


IdentityScope

public IdentityScope(String name)
已过时。 
构造具有指定名称的新身份作用域。

参数:
name - 作用域名称。

IdentityScope

public IdentityScope(String name,
                     IdentityScope scope)
              throws KeyManagementException
已过时。 
构造具有指定名称和作用域的新身份作用域。

参数:
name - 作用域名称。
scope - 新身份作用域的作用域。
抛出:
KeyManagementException - 在此作用域内已经存在一个具有相同名称的 Identity。
方法详细信息

getSystemScope

public static IdentityScope getSystemScope()
已过时。 
返回系统的身份作用域。

返回:
系统的身份作用域。
另请参见:
setSystemScope(java.security.IdentityScope)

setSystemScope

protected static void setSystemScope(IdentityScope scope)
已过时。 
设置系统的身份作用域。

首先,如果存在安全管理器,则用 "setSystemScope" 作为参数调用其 checkSecurityAccess 方法,以查看它是否可以设置身份作用域。

参数:
scope - 要设置的作用域。
抛出:
SecurityException - 如果安全管理器存在并且其 checkSecurityAccess 方法不允许设置身份作用域。
另请参见:
getSystemScope(), SecurityManager.checkSecurityAccess(java.lang.String)

size

public abstract int size()
已过时。 
返回此身份作用域内身份的数目。

返回:
此身份作用域内身份的数目。

getIdentity

public abstract Identity getIdentity(String name)
已过时。 
返回此作用域内具有指定名称的身份(如果有的话)。

参数:
name - 要获取的身份的名称。
返回:
名称为 name 的身份,如果在此作用域内没有名称为 name 的身份,则返回 null。

getIdentity

public Identity getIdentity(Principal principal)
已过时。 
获取名称与指定的主体相同的身份。(注:Identity 实现 Principal。)

参数:
principal - 相应于要获取的身份的主体。
返回:
名称与指定的主体相同的身份,如果在此作用域内没有具有该名称的身份,则返回 null。

getIdentity

public abstract Identity getIdentity(PublicKey key)
已过时。 
获取具有指定公钥的身份。

参数:
key - 要返回的身份的公钥。
返回:
具有给定密钥的身份,如果此作用域内没有具有该密钥的身份,则返回 null。

addIdentity

public abstract void addIdentity(Identity identity)
                          throws KeyManagementException
已过时。 
向此身份作用域添加一个身份。

参数:
identity - 要添加的身份。
抛出:
KeyManagementException - 如果身份是无效的、出现了名称冲突、另一个身份与要添加的身份有相同的公钥,或者出现其他异常

removeIdentity

public abstract void removeIdentity(Identity identity)
                             throws KeyManagementException
已过时。 
从此身份作用作用域移除一个身份。

参数:
identity - 要移除的身份。
抛出:
KeyManagementException - 如果身份丢失或出现其他的异常。

identities

public abstract Enumeration<Identity> identities()
已过时。 
返回此身份作用域内所有身份的枚举。

返回:
此身份作用域内所有身份的枚举。

toString

public String toString()
已过时。 
返回此身份作用域的字符串表示形式,包括其名称、作用域名称和此身份作用域中身份的数目。

指定者:
接口 Principal 中的 toString
覆盖:
Identity 中的 toString
返回:
此身份作用域的字符串表示形式。
另请参见:
SecurityManager.checkSecurityAccess(java.lang.String)

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策