Account Managing Service for the cloud-base API
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
Switcher AC integrates with other services to run.
- MongoDB
- GitHub OAuth
- Switcher API
- Supply file based on the production context a new one named: resources/application-local.properties
- Run
mvn clean install spring-boot:run -Plocal
- Configure environment variables at docker-env/.env
- Define volume for Switcher API snapshots and modify docker-compose volume device parameter.
- Run docker-compose
docker-compose --env-file ./docker-env/.env up
-
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.
- 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.
- 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.
- 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 specified.
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 }"
}
- Rate Limiter - /switcher/v1/limiter?value=externalId [GET]
Return rate limit allowed for an account externalId.
- Verify - /switcher/v1/verify [GET]
Return code verification used to verify deployment ownership.