Record Class BasicCredentials
java.lang.Object
java.lang.Record
com.iizix.server.push.engine.http.BasicCredentials
- Record Components:
userName- The user name, never null.password- The password, never null, possibly empty.
The user name and password of an
Authorization: Basic header, decoded as PUSH-WIRE-CONTRACT.md section 3.2 says: the scheme compared case-insensitively, the credentials decoded from base64 as UTF-8 (RFC 7617 charset) and split at the first colon, so a password may contain one.A header that is not Basic, not base64 or carries no colon parses to null; the caller answers one code for every one of those, so nothing here says which it was.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorsConstructorDescriptionBasicCredentials(String userName, String password) Creates an instance of aBasicCredentialsrecord class.Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static BasicCredentialsParses anAuthorizationheader.password()Returns the value of thepasswordrecord component.toString()Gets a string representation that never carries the password.userName()Returns the value of theuserNamerecord component.
Constructor Details
BasicCredentials
Method Details
parse
Parses anAuthorizationheader.- Parameters:
header- The header value, null for none.- Returns:
- The credentials, or null when the header is absent, not Basic, not base64, or carries no colon.
toString
hashCode
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).userName
password