# README
title: padlock v0.3.0 language_tabs:
- shell: Shell
- http: HTTP
- javascript: JavaScript
- ruby: Ruby
- python: Python
- php: PHP
- java: Java
- go: Go toc_footers: [] includes: [] search: false code_clipboard: true highlight_theme: darkula headingLevel: 2 generator: widdershins v4.0.1
padlock v0.3.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
External AuthN / AuthZ support service for REST API RBAC
Base URLs:
Management
User Management API liveness check
GET /v1/alive
Will return success to indicate user management REST API module is live
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | goutils.RestAPIBaseResponse |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
User Management API readiness check
GET /v1/ready
Will return success if user management REST API module is ready for use
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | goutils.RestAPIBaseResponse |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
List All Roles
GET /v1/role
List all roles the system is operating against
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"roles": {
"property1": {
"permissions": [
"string"
]
},
"property2": {
"permissions": [
"string"
]
}
},
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | apis.RespListAllRoles |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
Get info on role
GET /v1/role/{roleName}
Query for information regarding one role, along with users assigned this role.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
roleName | path | string | true | Role name |
Example responses
200 Response
{
"assigned_users": [
{
"created_at": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"updated_at": "string",
"user_id": "string",
"username": "string"
}
],
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"role": {
"permissions": [
"string"
]
},
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | apis.RespRoleInfo |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
List all users
GET /v1/user
List all users currently managed by the system
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true,
"users": [
{
"created_at": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"updated_at": "string",
"user_id": "string",
"username": "string"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | apis.RespListAllUsers |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
Define new user
POST /v1/user
Define a new user, and optionally assign roles to it
Body parameter
{
"roles": [
"string"
],
"user": {
"email": "string",
"first_name": "string",
"last_name": "string",
"user_id": "string",
"username": "string"
}
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
body | body | apis.ReqNewUserParams | true | New user information |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | goutils.RestAPIBaseResponse |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
Delete user
DELETE /v1/user/{userID}
Remove user from the system.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
userID | path | string | true | User ID |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | goutils.RestAPIBaseResponse |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
Get info on user
GET /v1/user/{userID}
Query for information regarding one user.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
userID | path | string | true | User ID |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true,
"user": {
"associatedPermission": [
"string"
],
"created_at": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"roles": [
"string"
],
"updated_at": "string",
"user_id": "string",
"username": "string"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | apis.RespUserInfo |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
Update a user's info
PUT /v1/user/{userID}
Update an existing user's information
Body parameter
{
"email": "string",
"first_name": "string",
"last_name": "string",
"user_id": "string",
"username": "string"
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
userID | path | string | true | User ID |
body | body | models.UserConfig | true | Updated user information |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | goutils.RestAPIBaseResponse |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
Update a user's roles
PUT /v1/user/{userID}/roles
Change the user's roles to what caller requested
Body parameter
{
"roles": [
"string"
]
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
userID | path | string | true | User ID |
body | body | apis.ReqNewUserRoles | true | User's new roles |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | goutils.RestAPIBaseResponse |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
Authorize
Check whether a REST API call is allowed
GET /v1/allow
Check whether a REST API call is allowed. The parameters of the call is passed in
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
X-Forwarded-Host | header | string | true | Host of the API call to authorize |
X-Forwarded-Uri | header | string | true | URI path of the API call to authorize |
X-Forwarded-Method | header | string | true | HTTP method of the API call to authorize |
X-Caller-UserID | header | string | true | ID of the user making the API call to authorize |
X-Caller-Username | header | string | false | Username of the user making the API call to authorize |
X-Caller-Firstname | header | string | false | First name / given name of the user making the API call to authorize |
X-Caller-Lastname | header | string | false | Last name / surname / family name of the user making the API call to authorize |
X-Caller-Email | header | string | false | Email of the user making the API call to authorize |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | goutils.RestAPIBaseResponse |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
403 | Forbidden | error | goutils.RestAPIBaseResponse |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
Authenticate
Authenticate a user
GET /v1/authenticate
Authticate a user by verifiying the bearer token provided
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
Padlock-Request-ID | header | string | false | User provided request ID to match against logs |
Authorization | header | string | true | User must provide a bearer token |
Example responses
200 Response
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | goutils.RestAPIBaseResponse |
400 | Bad Request | error | goutils.RestAPIBaseResponse |
401 | Unauthorized | error | string |
403 | Forbidden | error | string |
404 | Not Found | error | string |
500 | Internal Server Error | error | goutils.RestAPIBaseResponse |
Schemas
apis.ReqNewUserParams
{
"roles": [
"string"
],
"user": {
"email": "string",
"first_name": "string",
"last_name": "string",
"user_id": "string",
"username": "string"
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
roles | [string] | false | none | Roles list the roles to assign to this user |
user | models.UserConfig | true | none | User contains the new user parameters |
apis.ReqNewUserRoles
{
"roles": [
"string"
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
roles | [string] | false | none | Roles list the roles to assign to this user |
apis.RespListAllRoles
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"roles": {
"property1": {
"permissions": [
"string"
]
},
"property2": {
"permissions": [
"string"
]
}
},
"success": true
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
error | goutils.ErrorDetail | false | none | Error are details in case of errors |
request_id | string | true | none | RequestID gives the request ID to match against logs |
roles | object | true | none | Roles are the roles |
» additionalProperties | common.UserRoleConfig | false | none | none |
success | boolean | true | none | Success indicates whether the request was successful |
apis.RespListAllUsers
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true,
"users": [
{
"created_at": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"updated_at": "string",
"user_id": "string",
"username": "string"
}
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
error | goutils.ErrorDetail | false | none | Error are details in case of errors |
request_id | string | true | none | RequestID gives the request ID to match against logs |
success | boolean | true | none | Success indicates whether the request was successful |
users | [models.UserInfo] | true | none | Users are the users in system |
apis.RespRoleInfo
{
"assigned_users": [
{
"created_at": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"updated_at": "string",
"user_id": "string",
"username": "string"
}
],
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"role": {
"permissions": [
"string"
]
},
"success": true
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
assigned_users | [models.UserInfo] | false | none | AssignedUsers is the list of users being assigned this role |
error | goutils.ErrorDetail | false | none | Error are details in case of errors |
request_id | string | true | none | RequestID gives the request ID to match against logs |
role | common.UserRoleConfig | true | none | Role is info on this role |
success | boolean | true | none | Success indicates whether the request was successful |
apis.RespUserInfo
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true,
"user": {
"associatedPermission": [
"string"
],
"created_at": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"roles": [
"string"
],
"updated_at": "string",
"user_id": "string",
"username": "string"
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
error | goutils.ErrorDetail | false | none | Error are details in case of errors |
request_id | string | true | none | RequestID gives the request ID to match against logs |
success | boolean | true | none | Success indicates whether the request was successful |
user | users.UserDetailsWithPermission | true | none | User is info on this user |
common.UserRoleConfig
{
"permissions": [
"string"
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
permissions | [string] | true | none | AssignedPermissions is the list of permissions assigned to a role |
goutils.ErrorDetail
{
"code": 0,
"detail": "string",
"message": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
code | integer | true | none | Code is the response code |
detail | string | false | none | Detail is an optional descriptive message providing additional details on the error |
message | string | false | none | Msg is an optional descriptive message |
goutils.RestAPIBaseResponse
{
"error": {
"code": 0,
"detail": "string",
"message": "string"
},
"request_id": "string",
"success": true
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
error | goutils.ErrorDetail | false | none | Error are details in case of errors |
request_id | string | true | none | RequestID gives the request ID to match against logs |
success | boolean | true | none | Success indicates whether the request was successful |
models.UserConfig
{
"email": "string",
"first_name": "string",
"last_name": "string",
"user_id": "string",
"username": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
string | false | none | Email is the user's email | |
first_name | string | false | none | FirstName is the user's first name / given name |
last_name | string | false | none | LastName is the user's last name / surname / family name |
user_id | string | true | none | UserID is the user's ID |
username | string | false | none | UserName is the username |
models.UserInfo
{
"created_at": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"updated_at": "string",
"user_id": "string",
"username": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
created_at | string | false | none | CreatedAt is when the user entry is created |
string | false | none | Email is the user's email | |
first_name | string | false | none | FirstName is the user's first name / given name |
last_name | string | false | none | LastName is the user's last name / surname / family name |
updated_at | string | false | none | UpdatedAt is when the user entry was last updated |
user_id | string | true | none | UserID is the user's ID |
username | string | false | none | UserName is the username |
users.UserDetailsWithPermission
{
"associatedPermission": [
"string"
],
"created_at": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"roles": [
"string"
],
"updated_at": "string",
"user_id": "string",
"username": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
associatedPermission | [string] | false | none | AssociatedPermission list of permissions the user has based on the roles associated with the user |
created_at | string | false | none | CreatedAt is when the user entry is created |
string | false | none | Email is the user's email | |
first_name | string | false | none | FirstName is the user's first name / given name |
last_name | string | false | none | LastName is the user's last name / surname / family name |
roles | [string] | false | none | Roles are the roles associated with the user |
updated_at | string | false | none | UpdatedAt is when the user entry was last updated |
user_id | string | true | none | UserID is the user's ID |
username | string | false | none | UserName is the username |