trackerforce/switcher-ac

By trackerforce

Updated about 1 month ago

Switcher Account Control - Relay for Switcher API

Image
0

2.2K

trackerforce/switcher-ac repository overview


Switcher Account Control
Account Managing Service for the cloud-base API

Master CI Quality Gate Status Known Vulnerabilities License: MIT Slack: Switcher-HQ


About

Switcher Account Control is a simple API written in Java/SpringBoot responsible for managing feature accesses to the Switcher API cloud version.

  • Managing access to Switcher API
  • Managing plans & limitations
  • Features availability
  • Admin resources accessible via GitHub OAuth

Configuration

Switcher AC integrates with other services to run.

  • MongoDB
  • GitHub OAuth
  • Switcher API

Running

  1. Configure environment variables at docker-env/.env
  2. Define volume for Switcher API snapshots and modify docker-compose volume device parameter.
  3. Run docker-compose
docker-compose --env-file ./docker-env/.env up

Usage

  • API Check - /api/check [GET]
    Verifies if API is online.
    No authorization required.

  • Swagger Definition - /v3/api-docs [GET]
    Retrieve API swagger definition

  • Swagger UI - /swagger-ui.html
    Access Swagger UI.
    Use /admin/auth/github to generate API access token.

  • Actuator - /actuator [GET]
    Retrieve actuator resources available.
    Requires authentication as Admin.

Admin
  • Login with GitHub - /admin/auth/github?code=GIT_CODE [POST]

After running the GitHub OAuth callback function via: https://github.com/login/oauth/authorize?client_id=APP_ID the GIT_CODE will be given to access this resource and eventually proceed with the internal authentication.

  • Refresh JWT - /admin/auth/refresh?refreshToken=REFRESH_TOKEN [POST]

When authenticating it will be given a pair of tokens. The refresh token will be used to re-generate a new pair once the access token has expired.

  • Loging Out - /admin/v1/logout [POST]

Well, it logout the admin user.

  • List plans - /admin/v1/plan/list [GET]

Return all registered plans.

  • Get plan - /admin/plan/v1/get?plan={PLAN_NAME} [GET]

Return a specific plan.

  • Create plan - /admin/v1/plan [POST]

Create new plan.

{
    "name": "BASIC",
    "maxDomains": 1,
    "maxGroups": 5,
    "maxSwitchers": 20,
    "maxComponents": 5,
    "maxEnvironments": 3,
    "maxTeams": 5,
    "maxDailyExecution": 500
}
  • Delete plan - /admin/v1/plan?plan={PLAN_NAME} [POST]

Delete a specific plan.

  • Change account plan - /admin/v1/account/change/:externalId?plan={PLAN_NAME} [PATCH]

Change account plan to the one especified.

  • Reset account execution daily limit - /admin/v1/account/reset/:externalId [PATCH]

Reset the number of executions for a specific account.

Switcher

Switcher authorization token is required.

  • Create account - /switcher/v1/create [POST]

Create new account with defatul plan.

{
    "value": "{externalId}"
}
  • Remove account - /switcher/v1/remove [POST]

Remove account.

{
    "value": "{externalId}"
}
  • Feature validation - /switcher/v1/validate [POST]

Execute the validation based on the name of the feature and account externalId.

{
    "payload": "{ \"feature\": \"FEATURE_NAME\", \"owner\": \"EXTERNAL_ID\", \"total\": NUM_VALUE }"
}
  • Usage validation - /switcher/v1/execution?value={externalId} [POST]

Verify account usage.

Tag summary

Content type

Image

Digest

sha256:c58fba143

Size

126.4 MB

Last updated

about 1 month ago

docker pull trackerforce/switcher-ac