Package org.wiremock.url
Interface UserInfo
- All Superinterfaces:
Normalisable<UserInfo>,org.wiremock.stringparser.ParsedString,PercentEncoded<UserInfo>
Represents the user information component of a URI authority as defined in RFC 3986 Section 3.2.1.
User information typically consists of a username and optional password in the form
username[:password]. It appears before the host in a URI, separated by an @ symbol.
Security Note: Including passwords in URIs is deprecated due to security concerns. Most modern protocols discourage this practice.
Implementations must be immutable and thread-safe.
- See Also:
-
Method Summary
Methods inherited from interface org.wiremock.url.Normalisable
isNormalForm, normaliseMethods inherited from interface org.wiremock.stringparser.ParsedString
toStringMethods inherited from interface org.wiremock.url.PercentEncoded
decode, isEmpty, length
-
Method Details
-
parse
Parses a string into user info.- Parameters:
userInfoString- the string to parse- Returns:
- the parsed user info
- Throws:
IllegalUserInfo- if the string is not valid user info
-
encode
Encodes a string into valid user info with proper percent-encoding.- Parameters:
unencoded- the unencoded string- Returns:
- the encoded user info
-
getUsername
Username getUsername()Returns the username component.- Returns:
- the username, never
null
-
getPassword
@Nullable Password getPassword()Returns the password component, ornullif there is no password.- Returns:
- the password, or
nullif absent
-