public boolean blockingUpdateClientApp ( HttpRequest req , String clientId ) throws OAuthException { String contentType = req . headers ( ) . get ( HttpHeaderNames . CONTENT_TYPE ) ; if ( contentType != null && contentType . contains ( ResponseBuilder . APPLICATION_JSON ) ) { // String LOCAL_NODE_ID = getBasicAuthorizationClientId(req); // if (LOCAL_NODE_ID == null) { // throw new OAuthException(ResponseBuilder.INVALID_CLIENT_ID, HttpResponseStatus.BAD_REQUEST); // } if ( ! isExistingClient ( clientId ) . blockingGet ( ) ) { throw new OAuthException ( ResponseBuilder . INVALID_CLIENT_ID , HttpResponseStatus . BAD_REQUEST ) ; } ApplicationInfo appInfo ; try { FullHttpRequest fullHttpRequest = ( FullHttpRequest ) req ; appInfo = InputValidator . validate ( fullHttpRequest . content ( ) . toString ( CharsetUtil . UTF_8 ) , ApplicationInfo . class ) ; if ( appInfo . validForUpdate ( ) ) { if ( appInfo . getScope ( ) != null ) { String [ ] scopeList = appInfo . getScope ( ) . split ( " " ) ; for ( String s : scopeList ) { if ( db . findScope ( s ) . blockingGet ( ) == null ) { throw new OAuthException ( ResponseBuilder . SCOPE_NOT_EXIST , HttpResponseStatus . BAD_REQUEST ) ; } } } db . updateClientCredentials ( clientId , appInfo . getScope ( ) , appInfo . getDescription ( ) , appInfo . getStatus ( ) , appInfo . getApplicationDetails ( ) ) . blockingGet ( ) ; } else { throw new OAuthException ( ResponseBuilder . UPDATE_APP_MANDATORY_PARAM_MISSING , HttpResponseStatus . BAD_REQUEST ) ; } } catch ( Throwable e ) { LOG . error ( "cannot update client application" , e ) ; throw new OAuthException ( e , ResponseBuilder . CANNOT_UPDATE_APP , HttpResponseStatus . BAD_REQUEST ) ; } } else { throw new OAuthException ( ResponseBuilder . UNSUPPORTED_MEDIA_TYPE , HttpResponseStatus . BAD_REQUEST ) ; } return true ; }
blocking update client app