{"openapi":"3.0.1","info":{"title":"2Share Wrapper","version":"v1","description":"An Web API created for Central Bank of Curacao and St.Maarten that encapsulates (wraps) the FortiAuthenticator API to create and modify FA users and authenticate this user using Multifactor Authentication. \n\nThe wrapper is used by CBCS portal as well as CBCS applications. \nIt enables the CBCS to reserve FA tokens per application. These applications can add the FA tokens to a bucket to be used when creating users which have soft or hard token type. \n\nIn order for the applications to connect first step is to create a \"Group\" in FA that represents the application that is using the CBCS portal. For eg currently \"BOP\" and \"SIIQ\" groups (apps) are added to FA. These groupnames are used in APPBUCKETS as well as LOCALUSER rest calls.\nAnywhere \"app\" is displayed as a parameter the group/application name should be used. \n\nThe CBCS applications that use the wrapper must be provided a username and password to connect via basic authentication. These values should be added to the  appsettings.json file below the wrapper's directory.  \n\nEG:\n\n \"Apps\": {\n    \"SIIQ\": {\n      \"UserName\": \"mario\",\n      \"Password\": \"secret\"\n    },\n    \"PORTAL\": {\n      \"UserName\": \"mario\",\n      \"Password\": \"Secret\"\n    },\n    \"BOP\": {\n      \"UserName\": \"luciano\",\n      \"Password\": \"bettersecret\"\n    }\n  }                  ","termsOfService":"https://www.nederlandict.nl/diensten/nederland-ict-voorwaarden/","contact":{"name":"Tupak Rosario","email":"tupak@2sharecw.com"}},"paths":{"/api/AppBuckets/getAvailableBucketTokens":{"get":{"tags":["AppBuckets"],"operationId":"GetAvailable","parameters":[{"name":"app","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResult"}}}}},"summary":"Gets total available and total added tokens by application and type (soft - ftm or hard - ftk)"}},"/api/AppBuckets/getBucketTokenSerial":{"get":{"tags":["AppBuckets"],"operationId":"GetBucketTokenSerial","parameters":[{"name":"app","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"string"}}}}},"summary":"Gets the next available FA token from the bucket using application and type (soft - ftm or hard - ftk)"}},"/api/AppBuckets/getTokenSerialApp":{"get":{"tags":["AppBuckets"],"operationId":"GetTokenApp","parameters":[{"name":"serial","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"string"}}}}},"summary":"Gets the application that is assigned to the FA token"}},"/api/AppBuckets/unassignBucketToken":{"post":{"tags":["AppBuckets"],"operationId":"UnassignBucketToken","parameters":[{"name":"userId","in":"query","schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResult"}}}}},"summary":"Unassigns a FA token in the bucket from the user","description":"Based on the userid sets the FA token in the bucket to blank so it becomes available to be reused"}},"/api/AppBuckets":{"post":{"tags":["AppBuckets"],"operationId":"AddtoBucket","parameters":[{"name":"total","in":"query","schema":{"type":"integer","format":"int32"}},{"name":"type","in":"query","schema":{"type":"string"}},{"name":"app","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResult"}}}}},"summary":"Add FA tokens to the buckets per application","description":"Based on total FA tokens to be added, the type (soft - ftm or hard - ftk) and application it adds the FA tokens to the bucket. "}},"/api/Auth":{"post":{"tags":["Auth"],"operationId":"Post","requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/AuthUser"}},"application/json":{"schema":{"$ref":"#/components/schemas/AuthUser"}},"text/json":{"schema":{"$ref":"#/components/schemas/AuthUser"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/AuthUser"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/LoginResult"}},"application/json":{"schema":{"$ref":"#/components/schemas/LoginResult"}},"text/json":{"schema":{"$ref":"#/components/schemas/LoginResult"}}}}},"summary":"Authenticates the user based on the username and password or token","description":"First call is username and password. If first call is positive\nsecond call is username and token \n\nNOTE this is used by portal   "}},"/api/Auth/{token}":{"get":{"tags":["Auth"],"operationId":"VerifyToken","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"text/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}}}}},"summary":"Based on 2SWrapper token provided by the wrapper the localuser is returnd to the CBCS Application","description":"After entering the correct FA token  the portal serverredirects the user to the selected application with a 2SWrapper token as a parameter.\n\nEG\n[APPLICATIONURL]?token=45DJDGAGFEDGSDDGDGSDEGD\n\nThe application should then make this function call using the 2SWrapper token provided. This will return the user that has succesfully logged on.  \n\nAfter succesfully authenticating the user, the second step involves entering the FA token provided via FA Mobile App, FA Hardtoken generator or sent by FA email and selecting the application the user wants to log on to.\n The urls of the applications the portal need to redirect to are included in the appsettings.json file below the portal directory as a \"URL\" json property. \nThe url of the FA group (ExtURL) is also included. These urls map to the apps (FA groups) the user is assigned to. The portal will display these apps on the second step.\n\nEG\n\n\"Apps\": {\n    \"0\": {\n      \"NAME\": \"SIIQ\",\n      \"URL\": \"https://siiq.cbcs.cw\" ,\n      \"ExtURL\": \"/api/v1/usergroups/12/\"\n    },\n    \"1\": {\n      \"NAME\": \"BOP\",\n      \"URL\": \"https://bop.cbcs.cw\",\n      \"ExtURL\": \"/api/v1/usergroups/13/\"\n    }\n  }                    "}},"/api/Generic/sendForgotpasswordEmail":{"post":{"tags":["Generic"],"operationId":"SendForgotpasswordEmail","requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"text/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/LocalUser"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"string"}},"text/json":{"schema":{"type":"string"}}}}},"summary":"Sends forgot password email with a link with the 2SWrapper token","description":"NOTE only used by portal"}},"/api/Generic/getLocaluserToken":{"post":{"tags":["Generic"],"operationId":"GetLocaluserToken","requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"text/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/LocalUser"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"string"}},"text/json":{"schema":{"type":"string"}}}}},"summary":"Generates a 2SWrapper token for localuser","description":"NOTE only used by portal"}},"/api/Groups":{"get":{"tags":["Groups"],"operationId":"Get","responses":{"200":{"description":"Success"}},"summary":"Gets the available groups (applications using the 2ShareWrapper) from FA"}},"/api/LocalUsers":{"get":{"tags":["LocalUsers"],"operationId":"Get","responses":{"200":{"description":"Success"}},"summary":"Gets all users created in FA"},"post":{"tags":["LocalUsers"],"operationId":"Post","requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"text/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/LocalUser"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"string"}},"text/json":{"schema":{"type":"string"}}}}},"summary":"Creates a user in FA","description":"the \"app\" parameter is the application the user belongs to. For eg \"BOP\" or \"SIIQ\".\nIn case the soft or hard tokens are used as tokentype the FA token is automatically assigned, if no tokens are available a message is returned \"no tokens available\". \nIn case the tokentype is email no FA token is assigned.\n\nAll other parameters originate from the FA API and therefore the documentation for these parameters can be found in the documenation of that API:  https://docs.fortinet.com/document/fortiauthenticator/5.3.0/release-notes                                                                 "}},"/api/LocalUsers/{id}":{"get":{"tags":["LocalUsers"],"operationId":"Get - ById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"text/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}}}}},"summary":"Gets the localusers from FA using the userid","description":"Using the FA userid the local user object can be retrieved"},"post":{"tags":["LocalUsers"],"operationId":"Post - ById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int32"}}],"requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"text/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/LocalUser"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"string"}},"text/json":{"schema":{"type":"string"}}}}},"summary":"Updates (Patches) the localuser in FA using the localuser objects","description":"NOTE: in case the tokentype is changed from soft - ftm or hard - ftk to \"email\" unassignBucketToken call from APPBUCKETS should be performed since email doesnt require a FA token. "},"delete":{"tags":["LocalUsers"],"operationId":"Delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"string"}},"text/json":{"schema":{"type":"string"}}}}},"summary":"Delets the localuser from FA using the FA userid"}},"/api/LocalUsers/username={username}":{"get":{"tags":["LocalUsers"],"operationId":"Get - ByUserName","parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"text/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}}}}},"summary":"Gets the localuser from FA using the username"}},"/api/LocalUsers/changePassword":{"post":{"tags":["LocalUsers"],"operationId":"ChangePassword","requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/LocalUserPasswordReset"}},"application/json":{"schema":{"$ref":"#/components/schemas/LocalUserPasswordReset"}},"text/json":{"schema":{"$ref":"#/components/schemas/LocalUserPasswordReset"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/LocalUserPasswordReset"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"string"}},"text/json":{"schema":{"type":"string"}}}}},"summary":"Changes the localuser password in FA using current password and the new password"}},"/api/LocalUsers/updatePassword/{id}":{"post":{"tags":["LocalUsers"],"operationId":"Updatepassword","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int32"}}],"requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"text/json":{"schema":{"$ref":"#/components/schemas/LocalUser"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/LocalUser"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"string"}},"text/json":{"schema":{"type":"string"}}}}},"summary":"Updates the users  password in FA using the id and localuser object"}}},"components":{"schemas":{"TokenResult":{"type":"object","properties":{"totalavailable":{"type":"integer","format":"int32"},"totaladded":{"type":"integer","format":"int32"},"resultCode":{"enum":[0,1],"type":"integer","format":"int32"}}},"AuthUser":{"type":"object","properties":{"username":{"type":"string"},"password":{"type":"string"},"token_Code":{"type":"string"}}},"LoginResult":{"type":"object","properties":{"result":{"type":"string"},"token":{"type":"string"}}},"LocalUser":{"type":"object","properties":{"username":{"type":"string"},"password":{"type":"string"},"email":{"type":"string"},"user_Groups":{"uniqueItems":false,"type":"array","items":{"type":"string"}},"token_Auth":{"type":"boolean"},"token_Type":{"type":"string"},"token_Serial":{"type":"string"},"id":{"type":"integer","format":"int32"},"active":{"type":"boolean"},"address":{"type":"string"},"city":{"type":"string"},"country":{"type":"string"},"custom1":{"type":"string"},"custom2":{"type":"string"},"custom3":{"type":"string"},"expires_At":{"type":"string"},"first_Name":{"type":"string"},"ftk_only":{"type":"boolean"},"ftm_act_method":{"type":"string"},"last_name":{"type":"string"},"mobile_number":{"type":"string"},"state":{"type":"string"},"mail_host":{"type":"string"},"mail_routing_address":{"type":"string"},"app":{"type":"string"}}},"LocalUserPasswordReset":{"type":"object","properties":{"username":{"type":"string"},"id":{"type":"integer","format":"int32"},"currentPassword":{"type":"string"},"newPassword":{"type":"string"}}}}}}