@@ -270,7 +270,12 @@ private Future<RequestContext> buildRequestContextWithoutCookie(HttpServerReques
270270 String username = credentials .substring (0 , colon );
271271 String password = credentials .substring (colon + 1 );
272272 int at = username .indexOf ("@" );
273- String domain = at > 0 ? username .substring (at + 1 ) : null ;
273+ String domain = null ;
274+ String usernameWithoutDomain = username ;
275+ if (at > 0 ) {
276+ domain = username .substring (at + 1 );
277+ usernameWithoutDomain = username .substring (0 , at );
278+ }
274279 request .pause ();
275280
276281 Future <String > tokenFuture = null ;
@@ -298,9 +303,9 @@ private Future<RequestContext> buildRequestContextWithoutCookie(HttpServerReques
298303 return Future .failedFuture (ex );
299304 }
300305 if (basicAuthConfig .getGrantType () == BasicAuthGrantType .clientCredentials ) {
301- tokenFuture = performClientCredentialsGrant (authEndpoint .getUrl (), username , password );
306+ tokenFuture = performClientCredentialsGrant (authEndpoint .getUrl (), usernameWithoutDomain , password );
302307 } else {
303- tokenFuture = performResourceOwnerPasswordCredentials (authEndpoint , username , password );
308+ tokenFuture = performResourceOwnerPasswordCredentials (authEndpoint , usernameWithoutDomain , password );
304309 }
305310 }
306311
@@ -452,7 +457,7 @@ private Future<String> performResourceOwnerPasswordCredentials(Endpoint authEndp
452457 logger .trace ("ROPC request to {} returned: {} {}" , authEndpoint , response .statusCode (), response .bodyAsString ());
453458 JsonObject body = response .bodyAsJsonObject ();
454459 String token = body .getString ("access_token" );
455- logger .debug ("Client {}@{} got token {}" , username , authEndpoint , token );
460+ logger .debug ("User {}@{} got token {}" , username , authEndpoint , token );
456461 return Future .succeededFuture (token );
457462 } catch (Throwable ex ) {
458463 logger .warn ("Failed to process client credentials grant for {}@{}: " , username , authEndpoint , ex );
0 commit comments