Principal
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
GroupPrincipal |
A UserPrincipal representing a group identity, used to
determine access rights to objects in a file system. |
UserPrincipal |
A Principal representing an identity used to determine access rights
to objects in a file system. |
X500Principal |
This class represents an X.500 Principal . |
|
This interface represents the abstract notion of a principal, which
can be used to represent any entity, such as an individual, a
corporation, and a login id.
Public Method Summary
abstract
boolean
|
equals( Object another)
Compares this principal to the specified object.
|
abstract
String
|
getName()
Returns the name of this principal.
|
abstract
int
|
hashCode()
Returns a hashcode for this principal.
|
boolean
|
implies( Subject subject)
Returns true if the specified subject is implied by this principal.
|
abstract
String
|
toString()
Returns a string representation of this principal.
|
Public Methods
public
abstract
boolean
equals
(Object another)
Compares this principal to the specified object. Returns true
if the object passed in matches the principal represented by
the implementation of this interface.
Parameters
another |
principal to compare with. |
Returns
- true if the principal passed in is the same as that
encapsulated by this principal, and false otherwise.
public
abstract
String
getName
()
Returns the name of this principal.
Returns
- the name of this principal.
public
abstract
int
hashCode
()
Returns a hashcode for this principal.
Returns
- a hashcode for this principal.
public
boolean
implies
(Subject subject)
Returns true if the specified subject is implied by this principal.
The default implementation of this method returns true if
subject
is non-null and contains at least one principal that
is equal to this principal.
Subclasses may override this with a different implementation, if
necessary.
Returns
- true if
subject
is non-null and is
implied by this principal, or false otherwise.
public
abstract
String
toString
()
Returns a string representation of this principal.
Returns
- a string representation of this principal.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-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 2024-07-10 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ePrincipal\u003c/code\u003e interface represents an entity, like an individual or corporation, used for security and access control.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods for comparison, retrieving the principal's name, calculating a hash code, and checking for implied relationships with a \u003ccode\u003eSubject\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eKey methods include \u003ccode\u003eequals\u003c/code\u003e, \u003ccode\u003egetName\u003c/code\u003e, \u003ccode\u003ehashCode\u003c/code\u003e, \u003ccode\u003eimplies\u003c/code\u003e, and \u003ccode\u003etoString\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eCommon implementations represent users, groups, or X.500 distinguished names.\u003c/p\u003e\n"]]],[],null,["public interface **Principal** \n\n|---|---|---|\n| Known Indirect Subclasses [GroupPrincipal](../../../reference/java/nio/file/attribute/GroupPrincipal.html), [UserPrincipal](../../../reference/java/nio/file/attribute/UserPrincipal.html), [X500Principal](../../../reference/javax/security/auth/x500/X500Principal.html) |----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| | [GroupPrincipal](../../../reference/java/nio/file/attribute/GroupPrincipal.html) | A `UserPrincipal` representing a *group identity*, used to determine access rights to objects in a file system. | | [UserPrincipal](../../../reference/java/nio/file/attribute/UserPrincipal.html) | A `Principal` representing an identity used to determine access rights to objects in a file system. | | [X500Principal](../../../reference/javax/security/auth/x500/X500Principal.html) | This class represents an X.500 `Principal`. | |||\n\nThis interface represents the abstract notion of a principal, which\ncan be used to represent any entity, such as an individual, a\ncorporation, and a login id. \n\nSee Also\n\n- [X509Certificate](../../../reference/java/security/cert/X509Certificate.html) \n\nPublic Method Summary\n\n|-------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract boolean | [equals](../../../reference/java/security/Principal.html#equals(java.lang.Object))([Object](../../../reference/java/lang/Object.html) another) Compares this principal to the specified object. |\n| abstract [String](../../../reference/java/lang/String.html) | [getName](../../../reference/java/security/Principal.html#getName())() Returns the name of this principal. |\n| abstract int | [hashCode](../../../reference/java/security/Principal.html#hashCode())() Returns a hashcode for this principal. |\n| boolean | [implies](../../../reference/java/security/Principal.html#implies(javax.security.auth.Subject))([Subject](../../../reference/javax/security/auth/Subject.html) subject) Returns true if the specified subject is implied by this principal. |\n| abstract [String](../../../reference/java/lang/String.html) | [toString](../../../reference/java/security/Principal.html#toString())() Returns a string representation of this principal. |\n\nPublic Methods \n\npublic abstract boolean\n**equals**\n([Object](../../../reference/java/lang/Object.html) another) \nCompares this principal to the specified object. Returns true\nif the object passed in matches the principal represented by\nthe implementation of this interface. \n\nParameters\n\n| another | principal to compare with. |\n|---------|----------------------------|\n\nReturns\n\n- true if the principal passed in is the same as that encapsulated by this principal, and false otherwise. \n\npublic abstract [String](../../../reference/java/lang/String.html)\n**getName**\n() \nReturns the name of this principal. \n\nReturns\n\n- the name of this principal. \n\npublic abstract int\n**hashCode**\n() \nReturns a hashcode for this principal. \n\nReturns\n\n- a hashcode for this principal. \n\npublic boolean\n**implies**\n([Subject](../../../reference/javax/security/auth/Subject.html) subject) \nReturns true if the specified subject is implied by this principal.\n\nThe default implementation of this method returns true if\n`subject` is non-null and contains at least one principal that\nis equal to this principal.\n\nSubclasses may override this with a different implementation, if\nnecessary. \n\nParameters\n\n| subject | the `Subject` |\n|---------|---------------|\n\nReturns\n\n- true if `subject` is non-null and is implied by this principal, or false otherwise. \n\npublic abstract [String](../../../reference/java/lang/String.html)\n**toString**\n() \nReturns a string representation of this principal. \n\nReturns\n\n- a string representation of this principal."]]