openapi: 3.0.2
info:
  description: Backend application for Cognito based user Authentication
  version: 1.11.0
  title: Cognito Backend App
servers:
  - url: "{protocol}://auth-api.{environment}.universum-access.com:{port}/{version}"
    description: "API Server"
    variables:
      version:
        default: "v0"
        enum:
          - "v0"
      port:
        default: "5000"
      environment:
        default: "local"
        enum:
          - "local"
          - "dev"
      protocol:
        default: "http"
        enum:
          - "http"
          - "https"
tags:
  - name: Admin Functionality
    description: APIs for User Management for Admins
  - name: Authentication
    description: APIs for Authentication for Users
  - name: OAuth Authentication
    description: APIs for OAuth based authentication for Users
  - name: User Management
    description: APIs for User Management for Users
  - name: App Management
    description: APIs for Application Management
  - name: Service Functionality
    description: APIs for Other Services
paths:
  "/private/createUser":
    post:
      tags:
        - Admin Functionality
      summary: Endpoint to Create User
      operationId: "createUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Create User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/createUserPostBody"
      responses:
        "200":
          description: Create User Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "409":
          description: User already exists
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/deleteUser":
    post:
      tags:
        - Admin Functionality
      summary: Endpoint to Delete User
      operationId: "deleteUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Delete User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/deleteUserPostBody"
      responses:
        "200":
          description: Delete User Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: Precondition Failed
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/disableUser":
    post:
      tags:
        - Admin Functionality
      summary: Endpoint to Disable User
      operationId: "disableUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Disable User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/disableUserPostBody"
      responses:
        "200":
          description: User is Successfully Disabled
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: Precondition Failed
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/enableUser":
    post:
      tags:
        - Admin Functionality
      summary: Endpoint to Enable User
      operationId: "enableUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Enable User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/enableUserPostBody"
      responses:
        "200":
          description: User is Successfully Enabled
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: Precondition Failed
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/adminUpdateUser":
    post:
      tags:
        - Admin Functionality
      summary: Endpoint for admin to update user attributes
      operationId: "adminUpdateUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Post Object to Update user information
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/adminUpdateUserPostBody"
      responses:
        "200":
          description: Successfully updated user attributes
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "404":
          description: User does not exist
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/addUserToGroup":
    post:
      tags:
        - Admin Functionality
      summary: Endpoint for admin to add user to group
      operationId: "addUserToGroup"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Post Object to add user to group
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/userGroupPostBody"
      responses:
        "200":
          description: Successfully added user to group
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "404":
          description: User or group does not exist
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/removeUserFromGroup":
    post:
      tags:
        - Admin Functionality
      summary: Endpoint for admin to remove user from group
      operationId: "removeUserFromGroup"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Post Object to remove user from group
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/userGroupPostBody"
      responses:
        "200":
          description: Successfully removed user from group
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "404":
          description: User or group does not exist
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/listUsers":
    get:
      tags:
        - Admin Functionality
      summary: Endpoint to list users
      operationId: "listUsers"
      parameters:
        - in: query
          name: attributes
          schema:
            type: string
          required: false
          description: Comma separated list of attributes to be returned
        - in: query
          name: limit
          schema:
            type: integer
          required: false
          description: Maximum number of records to be returned
        - in: query
          name: filters
          schema:
            type: string
          required: false
          description: Filters to be applied
        - in: query
          name: paginationToken
          schema:
            type: string
          required: false
          description: URL encoded pagination token returned in previous response
      security:
        - accessTokenCookie: []
      responses:
        "200":
          description: Successfully retrieved user list
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/listUsersInGroup":
    get:
      tags:
        - Admin Functionality
      summary: Endpoint to list users in group
      operationId: "listUsersInGroup"
      parameters:
        - in: query
          name: groupname
          schema:
            type: string
          required: true
          description: Name of the group to list users for
        - in: query
          name: limit
          schema:
            type: integer
          required: false
          description: Maximum number of records to be returned
        - in: query
          name: paginationToken
          schema:
            type: string
          required: false
          description: URL encoded pagination token returned in previous response
      security:
        - accessTokenCookie: []
      responses:
        "200":
          description: Successfully retrieved user list
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/listUserGroups":
    get:
      tags:
        - Admin Functionality
      summary: Endpoint to list groups for a user
      operationId: "listUserGroups"
      parameters:
        - in: query
          name: username
          schema:
            type: string
        - in: query
          name: limit
          schema:
            type: integer
          required: false
          description: Maximum number of records to be returned
        - in: query
          name: paginationToken
          schema:
            type: string
          required: false
          description: URL encoded pagination token returned in previous response
      security:
        - accessTokenCookie: []
      responses:
        "200":
          description: Successfully retrieved list of groups
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/listGroups":
    get:
      tags:
        - Admin Functionality
      summary: Endpoint to list groups
      operationId: "listGroups"
      parameters:
        - in: query
          name: limit
          schema:
            type: integer
          required: false
          description: Maximum number of records to be returned
        - in: query
          name: paginationToken
          schema:
            type: string
          required: false
          description: URL encoded pagination token returned in previous response
      security:
        - accessTokenCookie: []
      responses:
        "200":
          description: Successfully retrieved list of groups
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/adminLogoutUser":
    post:
      tags:
        - Admin Functionality
      summary: Endpoint to Admin Logout User
      operationId: "adminLogoutUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Admin Logout User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/adminLogoutUserPostBody"
      responses:
        "200":
          description: Successfully logged out user globally
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: Precondition Failed
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/login":
    post:
      tags:
        - Authentication
      summary: Endpoint to authenticate user
      operationId: "login"
      requestBody:
        description: Post Object to Login User
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/loginPostBody"
      responses:
        "200":
          description: Authentication Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
          headers:
            Set-Cookie:
              description: AccessToken and RefreshToken
              schema:
                type: string
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: Incorrect Login Credentials
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: Precondition Failed
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/token":
    post:
      tags:
        - Authentication
      summary: Endpoint to get AccessToken from Social Auth Code
      operationId: "userOAuth2Token"
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              "$ref": "#/components/schemas/oauth2TokenPostBody"
      responses:
        "200":
          description: Authentication Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
          headers:
            Set-Cookie:
              description: AccessToken and RefreshToken
              schema:
                type: string
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: Incorrect Login Attempt
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/refreshToken":
    post:
      tags:
        - Authentication
      summary: Endpoint to receive new Auth token from Refresh token
      operationId: "refreshToken"
      security:
        - refreshTokenCookie: []
      requestBody:
        description: Post Object to Refresh Token
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/refreshTokenPostBody"
      responses:
        "200":
          description: Authentication Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
          headers:
            Set-Cookie:
              description: Access Token
              schema:
                type: string
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized or RefreshToken Cookie is Missing
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/logout":
    post:
      tags:
        - Authentication
      summary: Endpoint to logout user
      operationId: "logout"
      security:
        - accessTokenCookie: []
      responses:
        "200":
          description: Log Out Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: Precondition Failed
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/validateToken":
    post:
      tags:
        - Authentication
      summary: Endpoint to Validate Access Token
      operationId: "validateToken"
      security:
        - accessTokenCookie: []
      responses:
        "200":
          description: Token validation done
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/authChallengePassword":
    post:
      tags:
        - Authentication
      summary: Endpoint to Respond to Auth Challenge
      operationId: "authChallengePassword"
      requestBody:
        description: Post Object to Respond to Auth Challenge
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/authChallengePasswordPostBody"
      responses:
        "200":
          description: Responding to Auth Challenge Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
          headers:
            Set-Cookie:
              description: AccessToken and RefreshToken
              schema:
                type: string
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/changePassword":
    post:
      tags:
        - User Management
      summary: Endpoint to change user password
      operationId: "changePassword"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Post Object to Change User Password
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/changePasswordPostBody"
      responses:
        "200":
          description: Successfully changed user password
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "429":
          description: Limit Exceeded
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/updateUser":
    post:
      tags:
        - User Management
      summary: Endpoint to update user attributes
      operationId: "updateUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Post Object to update user attributes
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/updateUserPostBody"
      responses:
        "200":
          description: Successfully updated user attributes
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/reinviteUser":
    post:
      tags:
        - User Management
      summary: Endpoint to Reinvite User
      operationId: "reinviteUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Reinvite User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/reinviteUserPostBody"
      responses:
        "200":
          description: Reinvite User was Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "404":
          description: User does not exist
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/userStatus":
    get:
      tags:
        - User Management
      summary: Endpoint to get user status
      operationId: "userStatus"
      parameters:
        - in: query
          name: username
          schema:
            type: string
          required: true
          description: Username
      responses:
        "200":
          description: Successfully retrieved user status
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/forgotPassword":
    post:
      tags:
        - User Management
      summary: Endpoint to initiate forgot password sequence
      operationId: "forgotPassword"
      requestBody:
        description: Post Object to initiate forgot password sequence
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/forgotPasswordPostBody"
      responses:
        "200":
          description: Successfully initiated forgot password sequence
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "404":
          description: User not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: User is not in a state to perform updates or user is not verified
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "429":
          description: Limit Exceeded
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/newAccount":
    post:
      tags:
        - User Management
      summary: Endpoint to initiate new account create
      operationId: "newAccount"
      requestBody:
        description: Post Object to initiate new account create
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/newAccount"
      responses:
        "200":
          description: Successfully initiated new account create
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "404":
          description: User not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: User is not in a state to perform updates or user is not verified
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "429":
          description: Limit Exceeded
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/confirmForgotPassword":
    post:
      tags:
        - User Management
      summary: Endpoint to confirm forgot password sequence
      operationId: "confirmForgotPassword"
      requestBody:
        description: Post Object to confirm forgot password sequence
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/confirmForgotPasswordPostBody"
      responses:
        "200":
          description: Successfully completed forgot password sequence
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "404":
          description: User not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/getUserDetails":
    get:
      tags:
        - User Management
      summary: Endpoint to get user details
      operationId: "getUserDetails"
      security:
        - accessTokenCookie: []
      responses:
        "200":
          description: Successfully retrieved user details
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/signup":
    post:
      tags:
        - Authentication
      summary: Endpoint for user to signup by himself
      operationId: "signup"
      requestBody:
        description: Post Object for user to signup
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/userSignupPostBody"
      responses:
        "201":
          description: Successfully signed up new user
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "409":
          description: User with this email already exists
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/confirmSignup":
    post:
      tags:
        - Authentication
      summary: Endpoint for user confirmation
      operationId: "confirmSignup"
      requestBody:
        description: Post Object for user to confirm signup
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/userSignupConfirmationPostBody"
      responses:
        "200":
          description: Successfully confirmed user
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/oauth2/login":
    get:
      tags:
        - OAuth Authentication
      summary: Login endpoint to redirect users to FE login or Redirect URL
      operationId: "OAuth2Login"
      responses:
        "302":
          description: Successfully redirected to FE login or OAuth redirect URL if valid cookie
  "/public/oauth2/token":
    post:
      tags:
        - OAuth Authentication
      summary: Endpoint to get access token from OAuth code
      operationId: "OAuth2Token"
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              "$ref": "#/components/schemas/oauth2TokenPostBody"
      responses:
        "200":
          description: Successfully retrieved tokens from code
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/oauth2TokenResponse"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/oauth2/userInfo":
    get:
      tags:
        - OAuth Authentication
      summary: Endpoint to get user information from access token
      operationId: "OAuth2UserInfo"
      security:
        - bearerAuth: []
      responses:
        "200":
          description: Successfully retrieved user information from token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/oauth2UserInfoResponse"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/healthCheck":
    get:
      tags:
        - App Management
      summary: Endpoint to check if the application is running
      operationId: "healthCheck"
      responses:
        "200":
          description: Successfully completed forgot password sequence
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/healthResponse"
        "500":
          description: Internal Server Error
  "/public/app/createUser":
    post:
      tags:
        - App Admin Functionality
      summary: Endpoint to Create App User
      operationId: "appCreateUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: App Create User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/appCreateUserPostBody"
      responses:
        "200":
          description: App Create User and Group addition was Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "409":
          description: User already exists
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "404":
          description: Group does not exist
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/app/updateUser":
    post:
      tags:
        - App Admin Functionality
      summary: Endpoint to Update App User
      operationId: "appUpdateUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: App Update User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/appUpdateUserPostBody"
      responses:
        "200":
          description: App Update User was Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "404":
          description: User does not exist
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/app/reinviteUser":
    post:
      tags:
        - App Admin Functionality
      summary: Endpoint to Reinvite App User
      operationId: "appReinviteUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: App Reinvite User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/appReinviteUserPostBody"
      responses:
        "200":
          description: App Reinvite User was Successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "404":
          description: User does not exist
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/app/disableUser":
    post:
      tags:
        - App Admin Functionality
      summary: Endpoint to Disable App User
      operationId: "appDisableUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Disable App User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/appDisableUserPostBody"
      responses:
        "200":
          description: App User is Successfully Disabled
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: Precondition Failed
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/app/enableUser":
    post:
      tags:
        - App Admin Functionality
      summary: Endpoint to Enable App User
      operationId: "appEnableUser"
      security:
        - accessTokenCookie: []
      requestBody:
        description: Enable App User Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/appEnableUserPostBody"
      responses:
        "200":
          description: App User is Successfully Enabled
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: Precondition Failed
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/public/app/userDetails":
    post:
      tags:
        - App Admin Functionality
      summary: Endpoint to get user details
      operationId: "appUserDetails"
      security:
        - accessTokenCookie: []
      requestBody:
        description: App User Details Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/appUserDetailsPostBody"
      responses:
        "200":
          description: App User Details successfully retrieved
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: Precondition Failed
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: User is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "403":
          description: User does not have permission to perform this operation
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/service/token":
    post:
      tags:
        - Service Functionality
      summary: Endpoint to get access token with Client Credentials
      operationId: "ServiceToken"
      security:
        - basicAuth: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              "$ref": "#/components/schemas/serviceTokenPostBody"
      responses:
        "200":
          description: Successfully retrieved token from Client Credentials
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/serviceTokenResponse"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/service/validate":
    get:
      tags:
        - Service Functionality
      summary: Endpoint to get validate access token
      operationId: "ServiceValidate"
      security:
        - bearerAuth: []
      responses:
        "200":
          description: Successfully validated Access Token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: Invalid AccessToken
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/service/listUsersInGroup":
    get:
      tags:
        - Service Functionality
      summary: Endpoint for other apps to list users in group
      operationId: "serviceListUsersInGroup"
      parameters:
        - in: query
          name: appGroup
          schema:
            type: string
          required: true
          description: Application Code
        - in: query
          name: limit
          schema:
            type: integer
          required: false
          description: Maximum number of records to be returned
        - in: query
          name: paginationToken
          schema:
            type: string
          required: false
          description: URL encoded pagination token returned in previous response
      security:
        - bearerAuth: []
      responses:
        "200":
          description: Successfully retrieved user list
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: App is not authorized
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: User group not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/service/userDetails":
    get:
      tags:
        - Service Functionality
      summary: Endpoint for other apps to get details of user from username
      operationId: "serviceUserDetails"
      parameters:
        - in: query
          name: username
          schema:
            type: string
          required: true
          description: Username
      security:
        - bearerAuth: []
      responses:
        "200":
          description: Successfully retrieved user details
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: Token is invalid
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "409":
          description: User not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
  "/private/service/deleteUser":
    post:
      tags:
        - Service Functionality
      summary: Endpoint for other apps to delete user by username
      operationId: "serviceDeleteUser"
      requestBody:
        description: Service User Delete Post Object
        required: true
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/serviceUserDeletePostBody"
      security:
        - bearerAuth: []
      responses:
        "200":
          description: Successfully deleted user
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/response"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "401":
          description: Token is invalid
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "404":
          description: User not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
        "412":
          description: Any unknown error
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errorResponse"
components:
  securitySchemes:
    accessTokenCookie:
      type: apiKey
      in: cookie
      name: AccessToken
    refreshTokenCookie:
      type: apiKey
      in: cookie
      name: RefreshToken
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    basicAuth:
      type: http
      scheme: basic
  schemas:
    response:
      type: object
      properties:
        message:
          type: string
        data:
          type: string
    oauth2TokenResponse:
      type: object
      properties:
        id_token:
          type: string
        access_token:
          type: string
        refresh_token:
          type: string
        expires_in:
          type: integer
        token_type:
          type: string
    oauth2UserInfoResponse:
      type: object
      properties:
        sub:
          type: string
        username:
          type: string
        email:
          type: string
    errorResponse:
      type: object
      properties:
        error:
          type: string
        error_description:
          type: string
    healthResponse:
      type: object
      properties:
        message:
          type: string
    loginPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
        password:
          type: string
          format: password
        OAuthParams:
          type: object
    authChallengePasswordPostBody:
      type: object
      properties:
        challengeName:
          type: string
          format: string
        session:
          type: string
          format: string
        username:
          type: string
          format: email
        newPassword:
          type: string
          format: password
        clientMetadata:
          type: object
    createUserPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
        userAttributes:
          type: string
          format: array
        clientMetadata:
          type: object
        tempPassword:
          type: string
          format: password
        sendEmail:
          type: boolean
          format: boolean
    deleteUserPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
    disableUserPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
    enableUserPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
    adminLogoutUserPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
    adminUpdateUserPostBody:
      type: object
      properties:
        userAttributes:
          type: string
          format: array
        username:
          type: string
          format: email
        clientMetadata:
          type: object
    userGroupPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
        groupname:
          type: string
          format: string
    changePasswordPostBody:
      type: object
      properties:
        previousPassword:
          type: string
          format: email
        proposedPassword:
          type: string
          format: string
    updateUserPostBody:
      type: object
      properties:
        userAttributes:
          type: string
          format: array
        clientMetadata:
          type: object
    reinviteUserPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
        userAttributes:
          type: string
          format: array
          description: Array of attributes of the user
        clientMetadata:
          type: object
          description: Other client metadata for email sending
        sendEmail:
          type: boolean
          format: boolean
          description: Boolean if the invitation email needs to be sent
        timestamp:
          type: integer
          description: Current timestamp
    newAccount:
      type: object
      properties:
        email:
          type: string
          format: email
        firstName:
          type: string
        lastName:
          type: string
        company:
          type: string
    forgotPasswordPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
        clientMetadata:
          type: object
    confirmForgotPasswordPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
        confirmationCode:
          type: string
          format: string
        password:
          type: string
          format: string
        clientMetadata:
          type: object
    refreshTokenPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
    userSignupPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
        password:
          type: string
          format: string
        userAttributes:
          type: string
          format: array
    userSignupConfirmationPostBody:
      type: object
      properties:
        username:
          type: string
          format: email
        code:
          type: string
          format: string
    oauth2TokenPostBody:
      type: object
      properties:
        grant_type:
          type: string
          description: The input grant type
        client_id:
          type: string
          description: OAuth Client ID
        redirect_uri:
          type: string
          description: URL to be redirected to
        code:
          type: string
          description: OAuth Code
        client_secret:
          type: string
          description: OAuth Client Secret
    appCreateUserPostBody:
      type: object
      properties:
        appGroup:
          type: string
          format: string
          description: Group ID for the application requesting the user addition
        managedUsername:
          type: string
          format: email
          description: Username of the user to be managed
        userAttributes:
          type: string
          format: array
          description: Array of attributes of the user
        clientMetadata:
          type: object
          description: Other client metadata for email sending
        tempPassword:
          type: string
          format: password
          description: Optional temporary password
        sendEmail:
          type: boolean
          format: boolean
          description: Boolean if the invitation email needs to be sent
        userRoles:
          type: string
          format: array
          description: Array of roles to be added to the user
    appUpdateUserPostBody:
      type: object
      properties:
        appGroup:
          type: string
          format: string
          description: Group ID for the application requesting the user update
        managedUsername:
          type: string
          format: email
          description: Username of the user to be managed
        userAttributes:
          type: string
          format: array
          description: Array of attributes of the user
        clientMetadata:
          type: object
          description: Other client metadata for email sending
        userRoles:
          type: string
          format: array
          description: Array of roles to be added to the user
    appReinviteUserPostBody:
      type: object
      properties:
        appGroup:
          type: string
          format: string
          description: Group ID for the application requesting the user update
        managedUsername:
          type: string
          format: email
          description: Username of the user to be managed
        userAttributes:
          type: string
          format: array
          description: Array of attributes of the user
        clientMetadata:
          type: object
          description: Other client metadata for email sending
        sendEmail:
          type: boolean
          format: boolean
          description: Boolean if the invitation email needs to be sent
        timestamp:
          type: integer
          description: Current timestamp
    appDisableUserPostBody:
      type: object
      properties:
        appGroup:
          type: string
          format: string
          description: Group ID for the application requesting the user update
        managedUsername:
          type: string
          format: email
          description: Username of the user to be disabled
    appEnableUserPostBody:
      type: object
      properties:
        appGroup:
          type: string
          format: string
          description: Group ID for the application requesting the user update
        managedUsername:
          type: string
          format: email
          description: Username of the user to be enabled
    appUserDetailsPostBody:
      type: object
      properties:
        appGroup:
          type: string
          format: string
          description: Group ID for the application requesting the user details
        managedUsername:
          type: string
          format: email
          description: Username of the user
    serviceTokenPostBody:
      type: object
      properties:
        grant_type:
          type: string
          description: The input grant type should be client_credentials
        scope:
          type: string
          description: Scope of the required token
    serviceTokenResponse:
      type: object
      properties:
        access_token:
          type: string
        expires_in:
          type: integer
        token_type:
          type: string
    serviceUserDeletePostBody:
      type: object
      properties:
        username:
          type: string
          format: email
