public final class DuoSupport extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.joda.time.format.DateTimeFormatter |
RFC_2822_DATE_FORMAT
RFC 2822 formatter for date/time.
|
| Modifier | Constructor and Description |
|---|---|
private |
DuoSupport()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private static String |
canonRequest(RequestBuilder request,
String date,
int sigVersion)
The signature requires that the request parameters being in a particular order as specified in the API.
|
private static String |
createQueryString(List<org.apache.http.NameValuePair> params)
Builds a string representaion of the query string with the parameter names is alphabetical order.
|
static String |
generateSignedRequestToken(DuoIntegration duo,
String username)
Created a signed request to Duo for a user.
|
static void |
signRequest(RequestBuilder request,
DuoIntegration duo)
Sign a Duo AuthAPI request.
|
static String |
validateSignedResponseToken(DuoIntegration duo,
String signedResponseToken)
Verify a signed response from Duo and extract the username.
|
public static final org.joda.time.format.DateTimeFormatter RFC_2822_DATE_FORMAT
@Nonnull @NotEmpty public static String generateSignedRequestToken(@Nonnull DuoIntegration duo, @Nonnull@NotEmpty String username) throws com.duosecurity.duoweb.DuoWebException
duo - integration parameters to useusername - user to authenticatecom.duosecurity.duoweb.DuoWebException - if an error occurs@Nonnull @NotEmpty public static String validateSignedResponseToken(@Nonnull DuoIntegration duo, @Nonnull@NotEmpty String signedResponseToken) throws com.duosecurity.duoweb.DuoWebException, InvalidKeyException, IOException, NoSuchAlgorithmException
duo - integration parameters to usesignedResponseToken - response to validatecom.duosecurity.duoweb.DuoWebException - if a Duo failure occursInvalidKeyException - if a key is invalidIOException - if an I/O error occursNoSuchAlgorithmException - if the hashing algorithm is unavailable@Nonnull @NotEmpty public static void signRequest(@Nonnull RequestBuilder request, @Nonnull DuoIntegration duo) throws InvalidKeyException, NoSuchAlgorithmException, UnsupportedEncodingException
request - the request to be signedduo - integration parameters to useInvalidKeyException - bad skey valueNoSuchAlgorithmException - unknown encryption algorithmUnsupportedEncodingException - failure from URLEncoderprivate static String canonRequest(@Nonnull RequestBuilder request, @Nonnull String date, int sigVersion) throws UnsupportedEncodingException
request - the requestdate - the datesigVersion - the signature versionUnsupportedEncodingException - failure from URLEncoderprivate static String createQueryString(@Nonnull List<org.apache.http.NameValuePair> params) throws UnsupportedEncodingException
params - the name/value pairs to be joinedUnsupportedEncodingException - failure from URLEncoderCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.