PostAuthenticationRequest schema added for auth body payload (FINERACT-1369)

This commit is contained in:
Danish Jamal
2021-09-05 21:46:10 +08:00
committed by Petri Tuomola
parent f2eedd1766
commit db04976f4f
2 changed files with 17 additions and 1 deletions
@@ -21,8 +21,10 @@ package org.apache.fineract.infrastructure.security.api;
import com.google.gson.Gson;
import com.sun.jersey.core.util.Base64;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -93,10 +95,11 @@ public class AuthenticationApiResource {
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Verify authentication", description = "Authenticates the credentials provided and returns the set roles and permissions allowed.")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = AuthenticationApiResourceSwagger.PostAuthenticationRequest.class)))
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AuthenticationApiResourceSwagger.PostAuthenticationResponse.class))),
@ApiResponse(responseCode = "400", description = "Unauthenticated. Please login") })
public String authenticate(final String apiRequestBodyAsJson,
public String authenticate(@Parameter(hidden = true) final String apiRequestBodyAsJson,
@QueryParam("returnClientList") @DefaultValue("false") boolean returnClientList) {
// TODO FINERACT-819: sort out Jersey so JSON conversion does not have
// to be done explicitly via GSON here, but implicit by arg
@@ -32,6 +32,19 @@ final class AuthenticationApiResourceSwagger {
}
@Schema(description = "PostAuthenticationRequest")
public static final class PostAuthenticationRequest {
private PostAuthenticationRequest() {
}
@Schema(required = true, example = "mifos")
public String username;
@Schema(required = true, example = "password")
public String password;
}
@Schema(description = "PostAuthenticationResponse")
public static final class PostAuthenticationResponse {