public static boolean validateAuthorizationRequest ( AuthRequestDto authRequestDto , OAuthApplicationDto oAuthApplicationDto ) throws OAuthException { if ( StringUtils . isNotBlank ( oAuthApplicationDto . getClientId ( ) ) && oAuthApplicationDto . getClientId ( ) . equals ( authRequestDto . getClientId ( ) ) ) { try { String decodedRedirectUri = java . net . URLDecoder . decode ( authRequestDto . getRedirectUri ( ) , "UTF-8" ) ; if ( StringUtils . isNotBlank ( oAuthApplicationDto . getRedirectUri ( ) ) && oAuthApplicationDto . getRedirectUri ( ) . equals ( decodedRedirectUri ) ) { return true ; } else { _logger . info ( "Request Redirect URI '" + authRequestDto . getRedirectUri ( ) + "' mismatch" ) ; throw new OAuthException ( ResponseCodes . INVALID_OR_MISSING_REDIRECT_URI , HttpResponseStatus . BAD_REQUEST ) ; } } catch ( UnsupportedEncodingException e ) { _logger . info ( "Request Redirect URI '" + authRequestDto . getRedirectUri ( ) + "' mismatch" ) ; throw new OAuthException ( ResponseCodes . INVALID_OR_MISSING_REDIRECT_URI , HttpResponseStatus . BAD_REQUEST ) ; } } else { _logger . info ( "Request Client ID '" + authRequestDto . getClientId ( ) + "' mismatch" ) ; throw new OAuthException ( ResponseCodes . INVALID_OR_MISSING_CLIENT_ID , HttpResponseStatus . BAD_REQUEST ) ; } }
Validates Authorization Request