Stay organized with collections
Save and categorize content based on your preferences.
UserPrincipalLookupService
abstract class UserPrincipalLookupService
An object to lookup user and group principals by name. A UserPrincipal
represents an identity that may be used to determine access rights to objects in a file system. A GroupPrincipal
represents a group identity. A UserPrincipalLookupService
defines methods to lookup identities by name or group name (which are typically user or account names). Whether names and group names are case sensitive or not depends on the implementation. The exact definition of a group is implementation specific but typically a group represents an identity created for administrative purposes so as to determine the access rights for the members of the group. In particular it is implementation specific if the namespace for names and groups is the same or is distinct. To ensure consistent and correct behavior across platforms it is recommended that this API be used as if the namespaces are distinct. In other words, the lookupPrincipalByName
should be used to lookup users, and lookupPrincipalByGroupName
should be used to lookup groups.
Summary
Protected constructors |
Initializes a new instance of this class.
|
Public methods |
abstract GroupPrincipal! |
Lookup a group principal by group name.
|
abstract UserPrincipal! |
Lookup a user principal by name.
|
Protected constructors
UserPrincipalLookupService
protected UserPrincipalLookupService()
Initializes a new instance of this class.
Public methods
lookupPrincipalByGroupName
abstract fun lookupPrincipalByGroupName(group: String!): GroupPrincipal!
Lookup a group principal by group name.
Where an implementation does not support any notion of group then this method always throws UserPrincipalNotFoundException
. Where the namespace for user accounts and groups is the same, then this method is identical to invoking lookupPrincipalByName
.
Parameters |
group |
String!: the string representation of the group to lookup |
Exceptions |
java.nio.file.attribute.UserPrincipalNotFoundException |
the principal does not exist or is not a group |
java.io.IOException |
if an I/O error occurs |
java.lang.SecurityException |
In the case of the default provider, and a security manager is installed, it checks RuntimePermission ("lookupUserInformation") |
lookupPrincipalByName
abstract fun lookupPrincipalByName(name: String!): UserPrincipal!
Lookup a user principal by name.
Parameters |
name |
String!: the string representation of the user principal to lookup |
Exceptions |
java.nio.file.attribute.UserPrincipalNotFoundException |
the principal does not exist |
java.io.IOException |
if an I/O error occurs |
java.lang.SecurityException |
In the case of the default provider, and a security manager is installed, it checks RuntimePermission ("lookupUserInformation") |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# UserPrincipalLookupService\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nUserPrincipalLookupService\n==========================\n\n```\nabstract class UserPrincipalLookupService\n```\n\n|---|---------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [java.nio.file.attribute.UserPrincipalLookupService](#) |\n\nAn object to lookup user and group principals by name. A [UserPrincipal](/reference/kotlin/java/nio/file/attribute/UserPrincipal) represents an identity that may be used to determine access rights to objects in a file system. A [GroupPrincipal](/reference/kotlin/java/nio/file/attribute/GroupPrincipal) represents a *group identity* . A `UserPrincipalLookupService` defines methods to lookup identities by name or group name (which are typically user or account names). Whether names and group names are case sensitive or not depends on the implementation. The exact definition of a group is implementation specific but typically a group represents an identity created for administrative purposes so as to determine the access rights for the members of the group. In particular it is implementation specific if the *namespace* for names and groups is the same or is distinct. To ensure consistent and correct behavior across platforms it is recommended that this API be used as if the namespaces are distinct. In other words, the [lookupPrincipalByName](#lookupPrincipalByName(kotlin.String)) should be used to lookup users, and [lookupPrincipalByGroupName](#lookupPrincipalByGroupName(kotlin.String)) should be used to lookup groups.\n\nSummary\n-------\n\n| Protected constructors ||\n|-----------------------------------------------------------------------------------------------------------|---|\n| [UserPrincipalLookupService](#UserPrincipalLookupService())`()` Initializes a new instance of this class. |\n\n| Public methods ||\n|--------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [GroupPrincipal](/reference/kotlin/java/nio/file/attribute/GroupPrincipal)! | [lookupPrincipalByGroupName](#lookupPrincipalByGroupName(kotlin.String))`(`group:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Lookup a group principal by group name. |\n| abstract [UserPrincipal](/reference/kotlin/java/nio/file/attribute/UserPrincipal)! | [lookupPrincipalByName](#lookupPrincipalByName(kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Lookup a user principal by name. |\n\nProtected constructors\n----------------------\n\n### UserPrincipalLookupService\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected UserPrincipalLookupService()\n```\n\nInitializes a new instance of this class.\n\nPublic methods\n--------------\n\n### lookupPrincipalByGroupName\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun lookupPrincipalByGroupName(group: String!): GroupPrincipal!\n```\n\nLookup a group principal by group name.\n\nWhere an implementation does not support any notion of group then this method always throws [UserPrincipalNotFoundException](/reference/kotlin/java/nio/file/attribute/UserPrincipalNotFoundException). Where the namespace for user accounts and groups is the same, then this method is identical to invoking [lookupPrincipalByName](#lookupPrincipalByName(kotlin.String)).\n\n| Parameters ||\n|---------|-------------------------------------------------------------------------------------------------------------------------------------|\n| `group` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the string representation of the group to lookup |\n\n| Return ||\n|-----------------------------------------------------------------------------|-------------------|\n| [GroupPrincipal](/reference/kotlin/java/nio/file/attribute/GroupPrincipal)! | a group principal |\n\n| Exceptions ||\n|----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `java.nio.file.attribute.UserPrincipalNotFoundException` | the principal does not exist or is not a group |\n| `java.io.IOException` | if an I/O error occurs |\n| `java.lang.SecurityException` | In the case of the default provider, and a security manager is installed, it checks [RuntimePermission](../../../lang/RuntimePermission.html#)`(\"lookupUserInformation\")` |\n\n### lookupPrincipalByName\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun lookupPrincipalByName(name: String!): UserPrincipal!\n```\n\nLookup a user principal by name.\n\n| Parameters ||\n|--------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the string representation of the user principal to lookup |\n\n| Return ||\n|---------------------------------------------------------------------------|------------------|\n| [UserPrincipal](/reference/kotlin/java/nio/file/attribute/UserPrincipal)! | a user principal |\n\n| Exceptions ||\n|----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `java.nio.file.attribute.UserPrincipalNotFoundException` | the principal does not exist |\n| `java.io.IOException` | if an I/O error occurs |\n| `java.lang.SecurityException` | In the case of the default provider, and a security manager is installed, it checks [RuntimePermission](../../../lang/RuntimePermission.html#)`(\"lookupUserInformation\")` |"]]