From 2f4dcbdd6cb10146704b760e4a1e060062bc7385 Mon Sep 17 00:00:00 2001 From: Vic Romero Date: Sat, 26 Nov 2022 22:36:25 -0600 Subject: [PATCH] FINERACT-1820: Update for Authentication in Legacy Docs --- .../api/AuthenticationApiResourceSwagger.java | 2 +- .../api/SelfAuthenticationApiResource.java | 3 +++ .../resources/static/legacy-docs/apiLive.htm | 20 +++++++++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResourceSwagger.java index 22a7d179e..8a650230f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResourceSwagger.java @@ -26,7 +26,7 @@ import org.apache.fineract.useradministration.data.RoleData; /** * Created by sanyam on 13/8/17. */ -final class AuthenticationApiResourceSwagger { +public final class AuthenticationApiResourceSwagger { private AuthenticationApiResourceSwagger() { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java index e5d3cd2a8..bb881048e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java @@ -21,6 +21,7 @@ package org.apache.fineract.portfolio.self.security.api; import io.swagger.v3.oas.annotations.Operation; 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; @@ -30,6 +31,7 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.apache.fineract.infrastructure.security.api.AuthenticationApiResource; +import org.apache.fineract.infrastructure.security.api.AuthenticationApiResourceSwagger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Scope; @@ -54,6 +56,7 @@ public class SelfAuthenticationApiResource { @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "Verify authentication", description = "Authenticates the credentials provided and returns the set roles and permissions allowed.\n\n" + "Please visit this link for more info - https://fineract.apache.org/legacy-docs/apiLive.htm#selfbasicauth") + @RequestBody(required = true, content = @Content(schema = @Schema(implementation = AuthenticationApiResourceSwagger.PostAuthenticationRequest.class))) @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SelfAuthenticationApiResourceSwagger.PostSelfAuthenticationResponse.class))) }) public String authenticate(final String apiRequestBodyAsJson) { diff --git a/fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm b/fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm index 7efe917f9..600844d55 100644 --- a/fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm +++ b/fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm @@ -39003,12 +39003,16 @@ Request Body:
-POST https://DomainName/api/v1/authentication?username={username}&password={password} +POST https://DomainName/api/v1/authentication -POST authentication?username=mifos&password=password +POST authentication Content-Type: application/json -No Request Body +Request Body +{ + "username": "mifos", + "password": "password" +}

Example response of autentication for user that is not linked with any staff.

@@ -46956,12 +46960,16 @@ No Request Body
-POST https://DomainName/api/v1/self/authentication?username={username}&password={password} +POST https://DomainName/api/v1/self/authentication -POST self/authentication?username=mifos&password=password +POST self/authentication Content-Type: application/json -No Request Body +Request Body +{ + "username": "mifos", + "password": "password" +}

Example response of autentication for user