diff --git a/wsmaster/che-core-api-user/src/main/java/org/eclipse/che/api/user/server/UserService.java b/wsmaster/che-core-api-user/src/main/java/org/eclipse/che/api/user/server/UserService.java index a5efd1e094..9cb5e8c433 100644 --- a/wsmaster/che-core-api-user/src/main/java/org/eclipse/che/api/user/server/UserService.java +++ b/wsmaster/che-core-api-user/src/main/java/org/eclipse/che/api/user/server/UserService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2025 Red Hat, Inc. + * Copyright (c) 2012-2026 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ @@ -51,6 +51,20 @@ public String getId() { return userId(); } + @GET + @Path("/name") + @Produces(TEXT_PLAIN) + @Operation( + summary = "Get current user name", + responses = { + @ApiResponse( + responseCode = "200", + description = "The response contains current user's name"), + }) + public String getUser() { + return EnvironmentContext.getCurrent().getSubject().getUserName(); + } + private static String userId() { return EnvironmentContext.getCurrent().getSubject().getUserId(); }