Skip to content

Commit

Permalink
fix(api): remove deprecated POST /login endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
cmark committed Sep 24, 2023
1 parent 6582d0b commit 6693bf6
Showing 1 changed file with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import com.b2international.commons.exceptions.BadRequestException;
import com.b2international.commons.exceptions.UnauthorizedException;
import com.b2international.snowowl.core.identity.Credentials;
import com.b2international.snowowl.core.identity.User;
import com.b2international.snowowl.core.identity.request.UserRequests;
import com.b2international.snowowl.core.rest.AbstractRestService;
Expand All @@ -41,25 +40,6 @@
@RequestMapping(produces={ MediaType.APPLICATION_JSON_VALUE })
public class ApiKeyService extends AbstractRestService {

@Operation(deprecated = true, description = "Use the `POST /token` endpoint instead")
@PostMapping("/login")
public User login(
@Parameter(name = "credentials", description = "The user credentials.", required = true)
@RequestBody Credentials credentials) {
try {
return UserRequests.prepareGenerateApiKey()
.setUsername(credentials.getUsername())
.setPassword(credentials.getPassword())
.setToken(credentials.getToken())
.buildAsync()
.execute(getBus())
.getSync();
} catch (UnauthorizedException e) {
// convert HTTP 401 to HTTP 400 in this endpoint
throw new BadRequestException(e.getMessage());
}
}

@Operation(description = "Generates a new API key using the given configuration.")
@PostMapping("/token")
public User token(
Expand Down

0 comments on commit 6693bf6

Please sign in to comment.