Class ExternalId
- java.lang.Object
-
- com.google.gerrit.server.account.externalids.ExternalId
-
- All Implemented Interfaces:
Serializable
public abstract class ExternalId extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExternalId.Key
-
Field Summary
Fields Modifier and Type Field Description static String
SCHEME_EXTERNAL
Scheme for external auth used during authentication, e.g.static String
SCHEME_GERRIT
Scheme used forAuthType.LDAP
,AuthType.CLIENT_SSL_CERT_LDAP
,AuthType.HTTP_LDAP
, andAuthType.LDAP_BIND
usernames.static String
SCHEME_GPGKEY
Scheme used for GPG public keys.static String
SCHEME_HTTP
Scheme for http resources.static String
SCHEME_HTTPS
Scheme for https resources.static String
SCHEME_MAILTO
Scheme used to represent only an email address.static String
SCHEME_USERNAME
Scheme for the username used to authenticate an account, e.g.static String
SCHEME_UUID
Scheme used for randomly created identities constructed by a UUID.static String
SCHEME_XRI
Scheme for xri resources.
-
Constructor Summary
Constructors Constructor Description ExternalId()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Account.Id
accountId()
abstract org.eclipse.jgit.lib.ObjectId
blobId()
ID of the note blob in the external IDs branch that stores this external ID.void
checkThatBlobIdIsSet()
static ExternalId
create(ExternalId.Key key, Account.Id accountId, String email, String hashedPassword, org.eclipse.jgit.lib.ObjectId blobId)
abstract String
email()
boolean
equals(Object obj)
For checking if two external IDs are equals the blobId is excluded and external IDs that have different blob IDs but identical other fields are considered equal.static Stream<String>
getEmails(Collection<ExternalId> extIds)
Returns all IDs of the provided external IDs that have theSCHEME_MAILTO
scheme as a distinct stream.static Optional<String>
getUserName(Collection<ExternalId> extIds)
Returns the ID of the first external ID from the provided external IDs that has theSCHEME_USERNAME
scheme.int
hashCode()
abstract boolean
isCaseInsensitive()
boolean
isScheme(String scheme)
static boolean
isValidUsername(String username)
abstract ExternalId.Key
key()
abstract String
password()
byte[]
toByteArray()
String
toString()
Exports this external ID as Git config file text.void
writeToConfig(org.eclipse.jgit.lib.Config c)
-
-
-
Field Detail
-
SCHEME_GERRIT
public static final String SCHEME_GERRIT
Scheme used forAuthType.LDAP
,AuthType.CLIENT_SSL_CERT_LDAP
,AuthType.HTTP_LDAP
, andAuthType.LDAP_BIND
usernames.The name
gerrit:
was a very poor choice.Scheme names must not contain colons (':').
Will be handled case insensitive, if auth.userNameCaseInsensitive = true.
- See Also:
- Constant Field Values
-
SCHEME_UUID
public static final String SCHEME_UUID
Scheme used for randomly created identities constructed by a UUID.- See Also:
- Constant Field Values
-
SCHEME_MAILTO
public static final String SCHEME_MAILTO
Scheme used to represent only an email address.- See Also:
- Constant Field Values
-
SCHEME_USERNAME
public static final String SCHEME_USERNAME
Scheme for the username used to authenticate an account, e.g. over SSH.Will be handled case insensitive, if auth.userNameCaseInsensitive = true.
- See Also:
- Constant Field Values
-
SCHEME_GPGKEY
public static final String SCHEME_GPGKEY
Scheme used for GPG public keys.- See Also:
- Constant Field Values
-
SCHEME_EXTERNAL
public static final String SCHEME_EXTERNAL
Scheme for external auth used during authentication, e.g. OAuth Token- See Also:
- Constant Field Values
-
SCHEME_HTTP
public static final String SCHEME_HTTP
Scheme for http resources. OpenID in particular makes use of these external IDs.- See Also:
- Constant Field Values
-
SCHEME_HTTPS
public static final String SCHEME_HTTPS
Scheme for https resources. OpenID in particular makes use of these external IDs.- See Also:
- Constant Field Values
-
SCHEME_XRI
public static final String SCHEME_XRI
Scheme for xri resources. OpenID in particular makes use of these external IDs.- See Also:
- Constant Field Values
-
-
Method Detail
-
isValidUsername
public static boolean isValidUsername(String username)
-
getUserName
public static Optional<String> getUserName(Collection<ExternalId> extIds)
Returns the ID of the first external ID from the provided external IDs that has theSCHEME_USERNAME
scheme.- Parameters:
extIds
- external IDs- Returns:
- the ID of the first external ID from the provided external IDs that has the
SCHEME_USERNAME
scheme
-
getEmails
public static Stream<String> getEmails(Collection<ExternalId> extIds)
Returns all IDs of the provided external IDs that have theSCHEME_MAILTO
scheme as a distinct stream.- Parameters:
extIds
- external IDs- Returns:
- distinct stream of all IDs of the provided external IDs that have the
SCHEME_MAILTO
scheme
-
create
public static ExternalId create(ExternalId.Key key, Account.Id accountId, String email, String hashedPassword, org.eclipse.jgit.lib.ObjectId blobId)
-
key
public abstract ExternalId.Key key()
-
accountId
public abstract Account.Id accountId()
-
isCaseInsensitive
public abstract boolean isCaseInsensitive()
-
email
public abstract String email()
-
password
public abstract String password()
-
blobId
public abstract org.eclipse.jgit.lib.ObjectId blobId()
ID of the note blob in the external IDs branch that stores this external ID.null
if the external ID was created in code and is not yet stored in Git.
-
checkThatBlobIdIsSet
public void checkThatBlobIdIsSet()
-
isScheme
public boolean isScheme(String scheme)
-
toByteArray
public byte[] toByteArray()
-
equals
public final boolean equals(Object obj)
For checking if two external IDs are equals the blobId is excluded and external IDs that have different blob IDs but identical other fields are considered equal. This way an external ID that was loaded from Git can be equal with an external ID that was created from code.
-
toString
@Memoized public String toString()
Exports this external ID as Git config file text.The Git config has exactly one externalId subsection with an accountId and optionally email and password:
[externalId "username:jdoe"] accountId = 1003407 email = [email protected] password = bcrypt:4:LCbmSBDivK/hhGVQMfkDpA==:XcWn0pKYSVU/UJgOvhidkEtmqCp6oKB7
-
writeToConfig
public void writeToConfig(org.eclipse.jgit.lib.Config c)
-
-