public abstract class UserPrincipalLookupService extends Object
UserPrincipal表示可用于确定文件系统中对象的访问权限的身份。
A GroupPrincipal表示组身份 。
UserPrincipalLookupService定义了通过名称或组名(通常是用户或帐户名称)查找身份的方法。
名称和组名称是否区分大小写取决于实现。
组的确切定义是实现特定的,但通常组代表为管理目的而创建的身份,以便确定组成员的访问权限。
尤其是实现特定如果名和组的命名空间是相同的或显着。
为了确保跨平台的一致和正确的行为,建议使用这个API,就像命名空间是不同的。
换句话说, lookupPrincipalByName应该用于查找用户,而lookupPrincipalByGroupName应该用于查找组。
FileSystem.getUserPrincipalLookupService()
| Modifier | Constructor and Description |
|---|---|
protected |
UserPrincipalLookupService()
初始化此类的新实例。
|
| Modifier and Type | Method and Description |
|---|---|
abstract GroupPrincipal |
lookupPrincipalByGroupName(String group)
按组名查找组主体。
|
abstract UserPrincipal |
lookupPrincipalByName(String name)
按名称查找用户主体。
|
public abstract UserPrincipal lookupPrincipalByName(String name) throws IOException
name - 要查找的用户主体的字符串表示形式
UserPrincipalNotFoundException - 校长不存在
IOException - 如果发生I / O错误
SecurityException - 在默认提供程序的情况下,安装了一个安全管理器,它检查RuntimePermission ("lookupUserInformation")
public abstract GroupPrincipal lookupPrincipalByGroupName(String group) throws IOException
如果实现不支持组的任何概念,那么这种方法总是会抛出UserPrincipalNotFoundException 。 在用户帐户和组的命名空间相同的地方,该方法与调用lookupPrincipalByName相同 。
group - 要查找的组的字符串表示形式
UserPrincipalNotFoundException - 校长不存在或不属于团体
IOException - 如果发生I / O错误
SecurityException - In the case of the default provider, and a security manager is installed, it checks
RuntimePermission
("lookupUserInformation")
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.