use of org.apereo.cas.support.oauth.OAuth20GrantTypes in project cas by apereo.
the class OAuth20AccessTokenEndpointController method checkGrantTypes.
/**
* Check the grant type against expected grant types.
*
* @param type the current grant type
* @param expectedTypes the expected grant types
* @return whether the grant type is supported
*/
private boolean checkGrantTypes(final String type, final OAuth20GrantTypes... expectedTypes) {
LOGGER.debug("Grant type: [{}]", type);
for (final OAuth20GrantTypes expectedType : expectedTypes) {
if (isGrantType(type, expectedType)) {
return true;
}
}
LOGGER.error("Unsupported grant type: [{}]", type);
return false;
}
use of org.apereo.cas.support.oauth.OAuth20GrantTypes in project cas by apereo.
the class BaseOAuth20TokenRequestValidator method isGrantTypeSupported.
/**
* Check the grant type against expected grant types.
*
* @param type the current grant type
* @param expectedTypes the expected grant types
* @return whether the grant type is supported
*/
private static boolean isGrantTypeSupported(final String type, final OAuth20GrantTypes... expectedTypes) {
LOGGER.debug("Grant type received: [{}]", type);
for (final OAuth20GrantTypes expectedType : expectedTypes) {
if (OAuth20Utils.isGrantType(type, expectedType)) {
return true;
}
}
LOGGER.error("Unsupported grant type: [{}]", type);
return false;
}
Aggregations