use of org.apache.commons.lang3.math.NumberUtils.toLong in project cas by apereo.
the class OidcAuthorizationRequestSupport method getOidcMaxAgeFromAuthorizationRequest.
/**
* Gets oidc max age from authorization request.
*
* @param context the context
* @return the oidc max age from authorization request
*/
public static Optional<Long> getOidcMaxAgeFromAuthorizationRequest(final WebContext context) {
final URIBuilder builderContext = new URIBuilder(context.getFullRequestURL());
final Optional<URIBuilder.BasicNameValuePair> parameter = builderContext.getQueryParams().stream().filter(p -> OidcConstants.MAX_AGE.equals(p.getName())).findFirst();
if (parameter.isPresent()) {
final long maxAge = NumberUtils.toLong(parameter.get().getValue(), -1);
return Optional.of(maxAge);
}
return Optional.empty();
}
Aggregations