Skip to content

Commit ab07c63

Browse files
committed
Don't include domain when authenticating users with an IdP.
1 parent 8f4b39a commit ab07c63

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

query-engine/docs/query-engine-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ services:
5050
- 16686:16686
5151

5252
query-engine:
53-
image: ghcr.io/yaytay/query-engine-design-mode:0.0.64-2-main
53+
image: ghcr.io/yaytay/query-engine-design-mode:0.0.65-main
5454
ports:
5555
- 2000:8080
5656
volumes:

query-engine/src/main/java/uk/co/spudsoft/query/exec/conditions/RequestContextBuilder.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

query-engine/src/main/java/uk/co/spudsoft/query/main/Version.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public final class Version {
3434
/**
3535
* The project version, as set in the Maven pom.xml.
3636
*/
37-
public static final String MAVEN_PROJECT_VERSION = "0.0.64-2-main";
37+
public static final String MAVEN_PROJECT_VERSION = "0.0.65-main";
3838

3939
private Version() {
4040
}

0 commit comments

Comments
 (0)