public final class HawkServer extends java.lang.Object implements java.lang.Comparable<HawkServer>
| Modifier and Type | Class and Description |
|---|---|
static class |
HawkServer.Builder |
| Modifier and Type | Method and Description |
|---|---|
void |
authenticate(HawkCredentials credentials,
java.net.URI uri)
Authenticate a request using a Hawk bewit.
|
void |
authenticate(HawkCredentials credentials,
java.net.URI uri,
java.lang.String method,
com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> authorizationHeaders,
java.lang.String hash,
boolean hasBody)
Authenticate a request using Hawk.
|
int |
compareTo(HawkServer that) |
boolean |
equals(java.lang.Object that) |
java.lang.String |
extractBewit(java.net.URI uri)
Extract a bewit from a URI.
|
java.lang.String |
generateAuthenticateHeader()
Generate text for a WWW-Authenticate header after a failed authentication.
|
int |
hashCode() |
com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> |
splitAuthorizationHeader(java.lang.String authorizationheader) |
com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> |
splitBewit(java.lang.String bewit)
Split a base64-encoded bewit into individual fields.
|
java.lang.String |
toString() |
public void authenticate(HawkCredentials credentials, java.net.URI uri, java.lang.String method, com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> authorizationHeaders, java.lang.String hash, boolean hasBody)
credentials - the Hawk credentials against which to authenticateuri - the URI of the requestmethod - the method of the requestauthorizationHeaders - the Hawk authentication headershash - the hash of the body, if availablehasBody - true if the request has a body, false if notpublic void authenticate(HawkCredentials credentials, java.net.URI uri)
credentials - the Hawk credentials against which to authenticateuri - the URI of the requestpublic java.lang.String generateAuthenticateHeader()
Note that this generates the header's contents, and not the header itself.
public com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> splitAuthorizationHeader(java.lang.String authorizationheader)
public com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> splitBewit(java.lang.String bewit)
bewit - the base64-encoded bewitcom.wealdtech.DataError - If the bewit is invalid in some waypublic java.lang.String extractBewit(java.net.URI uri)
uri - the URI from which to pull the bewitcom.wealdtech.DataError - if there is an issue with the data that prevents obtaining the bewitpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object that)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(HawkServer that)
compareTo in interface java.lang.Comparable<HawkServer>