Package io.jenkins.plugins.authcommons
Record Class Principal
java.lang.Object
java.lang.Record
io.jenkins.plugins.authcommons.Principal
- Record Components:
sid- the identifier to store in authorization configuration, e.g. a username or a group object idtype- whether this is a user or a groupdisplayName- a human readable name, e.g. the user's full name; the factory methods fall back to the SIDdescription- optional secondary information that helps tell similar principals apart, e.g. an email addressavatarUrl- optional URL of a small picture of the principal, e.g. a profile photo; it is loaded by the browser, so it is typically served by the providing plugin with the same permission checks as the search
public record Principal(String sid, PrincipalType type, String displayName, String description, String avatarUrl)
extends Record
A user or group known to the security realm, as returned by a
PrincipalSearchProvider.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theavatarUrlrecord component.Returns the value of thedescriptionrecord component.Returns the value of thedisplayNamerecord component.final booleanIndicates whether some other object is "equal to" this one.static Principalfinal inthashCode()Returns a hash code value for this object.sid()Returns the value of thesidrecord component.net.sf.json.JSONObjecttoJson()final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.static PrincipalwithAvatarUrl(String avatarUrl)
-
Constructor Details
-
Principal
public Principal(@NonNull String sid, @NonNull PrincipalType type, @NonNull String displayName, @CheckForNull String description, @CheckForNull String avatarUrl) Creates an instance of aPrincipalrecord class.- Parameters:
sid- the value for thesidrecord componenttype- the value for thetyperecord componentdisplayName- the value for thedisplayNamerecord componentdescription- the value for thedescriptionrecord componentavatarUrl- the value for theavatarUrlrecord component
-
Principal
public Principal(@NonNull String sid, @NonNull PrincipalType type, @NonNull String displayName, @CheckForNull String description)
-
-
Method Details
-
user
-
group
-
withAvatarUrl
- Returns:
- a copy of this principal with the given avatar URL
-
toJson
@NonNull public net.sf.json.JSONObject toJson() -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
sid
Returns the value of thesidrecord component.- Returns:
- the value of the
sidrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
displayName
Returns the value of thedisplayNamerecord component.- Returns:
- the value of the
displayNamerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
avatarUrl
Returns the value of theavatarUrlrecord component.- Returns:
- the value of the
avatarUrlrecord component
-