You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Joseph Makara (Jira)" <ji...@apache.org> on 2021/04/06 10:37:00 UTC

[jira] [Created] (FINERACT-1340) Add client IDs for self-service user in auth credentials

Joseph Makara created FINERACT-1340:
---------------------------------------

             Summary: Add client IDs for self-service user in auth credentials
                 Key: FINERACT-1340
                 URL: https://issues.apache.org/jira/browse/FINERACT-1340
             Project: Apache Fineract
          Issue Type: Improvement
          Components: Client, User Management
    Affects Versions: 1.5.0
            Reporter: Joseph Makara
             Fix For: 1.6.0
         Attachments: Screenshot from 2021-04-06 13-35-31.png

-X POST /self/authentication doesn't return a list of {{clients}} IDs associated with userId as documented in swagger

!Screenshot from 2021-04-06 13-35-31.png!
 
Request URL: https://mobile.mifos.io/fineract-provider/api/v1/self/authentication
{code:java}
curl \
--header "Content-Type: application/json" \
--header "Authorization: Basic c2VsZnNlcnZpY2VfaW1vYmlsZTpwYXNzd29yZA==" \
--header "Fineract-Platform-TenantId: mobile" \
--request POST \
--data '{"username":"selfservice_imobile", "password":"password"}' \
https://mobile.mifos.io/fineract-provider/api/v1/self/authentication --insecure
{code}
Returns
{code:java}
{
   "username":"selfservice_imobile",
   "userId":9,
   "base64EncodedAuthenticationKey":"c2VsZnNlcnZpY2VfaW1vYmlsZTpwYXNzd29yZA\u003d\u003d",
   "authenticated":true,
   "officeId":1,
   "officeName":"FOVISSSTE",
   "roles":[
      {
         "id":2,
         "name":"Self Service User",
         "description":"self service user role",
         "disabled":false
      }
   ],
   "permissions":[
      "REPORTING_SUPER_USER",
      "ALL_FUNCTIONS_READ",
      "BYPASS_TWOFACTOR",
      "CHECKER_SUPER_USER",
      "ALL_FUNCTIONS"
   ],
   "shouldRenewPassword":false,
   "isTwoFactorAuthenticationRequired":false
}
{code}
Expected result

Test:
{code:java}
curl \
  --header "Content-Type: application/json" \
  --header "Authorization: Basic bWFrYXJhOnBhc3N3b3Jk" \
  --header "Fineract-Platform-TenantId: default" \
  --request POST \
  --data  '{"username":"makara", "password":"password"}' \
  https://xxxxxx.com.au:9443/fineract-provider/api/v1/self/authentication --insecure
{code}
Returns - 

 "clients":[1] as shown in json below
{code:java}
{
   "username":"makara",
   "userId":6,
   "base64EncodedAuthenticationKey":"bWFrYXJhOnBhc3N3b3Jk",
   "authenticated":true,
   "officeId":1,
   "officeName":"Head Office",
   "roles":[
      {
         "id":2,
         "name":"Self Service User",
         "description":"self service user role",
         "disabled":false
      }
   ],
   "permissions":[
      "ALL_FUNCTIONS"
   ],
   "clients":[
      1
   ],
   "shouldRenewPassword":false,
   "isTwoFactorAuthenticationRequired":false
}
{code}
Use case: I would like to
 # authenticate customer (self service user), and extract clientId from clients[0] SelfAuthenticationApiResourceSwagger#clients
 # use the clientId to call -> /self/clients/\{clientId}/accounts
instead of
a. authenticate
b. Call -X GET /self/clients List Clients associated to the user
c. use the clientId to call -> /self/clients/\{clientId}/accounts

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)