-
Notifications
You must be signed in to change notification settings - Fork 39
Auth Role User
qiang.ou edited this page Jun 19, 2017
·
3 revisions
$client = new \Etcd\Client();$client->authEnable();message AuthEnableRequest {
}
message AuthEnableResponse {
ResponseHeader header = 1;
}$client->authDisable();message AuthDisableRequest {
}
message AuthDisableResponse {
ResponseHeader header = 1;
}$client->authenticate('user', 'password');message AuthenticateRequest {
string name = 1;
string password = 2;
}
message AuthenticateResponse {
ResponseHeader header = 1;
// token is an authorized token that can be used in succeeding RPCs
string token = 2;
}$client->addRole('admin');message AuthRoleAddRequest {
// name is the name of the role to add to the authentication system.
string name = 1;
}
message AuthRoleAddResponse {
ResponseHeader header = 1;
}
$client->getRole('admin');message AuthRoleGetRequest {
string role = 1;
}
message AuthRoleGetResponse {
ResponseHeader header = 1;
repeated authpb.Permission perm = 2;
}$client->deleteRole('admin');message AuthRoleDeleteRequest {
string role = 1;
}
message AuthRoleDeleteResponse {
ResponseHeader header = 1;
}$client->roleList();message AuthRoleListRequest {
}
message AuthRoleListResponse {
ResponseHeader header = 1;
repeated string roles = 2;
}$client->addUser('user', 'password');message AuthUserAddRequest {
string name = 1;
string password = 2;
}
message AuthUserAddResponse {
ResponseHeader header = 1;
}$client->getUser('root');message AuthUserGetRequest {
string name = 1;
}
message AuthUserGetResponse {
ResponseHeader header = 1;
repeated string roles = 2;
}$client->DeleteUser('root');message AuthUserDeleteRequest {
// name is the name of the user to delete.
string name = 1;
}
message AuthUserDeleteResponse {
ResponseHeader header = 1;
}$client->changeUserPassword('root', 'new password');message AuthUserChangePasswordRequest {
// name is the name of the user whose password is being changed.
string name = 1;
// password is the new password for the user.
string password = 2;
}
message AuthUserChangePasswordResponse {
ResponseHeader header = 1;
}$client->userList();message AuthUserListRequest {
}
message AuthUserListResponse {
ResponseHeader header = 1;
repeated string users = 2;
}$client->grantUserRole('root', 'root')message AuthUserGrantRoleRequest {
// user is the name of the user which should be granted a given role.
string user = 1;
// role is the name of the role to grant to the user.
string role = 2;
}
message AuthUserGrantRoleResponse {
ResponseHeader header = 1;
}$client->grantUserRole('root', 'root')message AuthUserRevokeRoleRequest {
string name = 1;
string role = 2;
}
message AuthUserRevokeRoleResponse {
ResponseHeader header = 1;
}$client->grantRolePermission('root', \Etcd\Client::PERMISSION_READWRITE, 'redis')message AuthRoleGrantPermissionRequest {
// name is the name of the role which will be granted the permission.
string name = 1;
// perm is the permission to grant to the role.
authpb.Permission perm = 2;
}
// Permission is a single entity
message Permission {
enum Type {
READ = 0;
WRITE = 1;
READWRITE = 2;
}
Type permType = 1;
bytes key = 2;
bytes range_end = 3;
}
message AuthRoleGrantPermissionResponse {
ResponseHeader header = 1;
}$client->revokeRolePermission('root', 'redis')message AuthRoleRevokePermissionRequest {
string role = 1;
string key = 2;
string range_end = 3;
}
message AuthRoleRevokePermissionResponse {
ResponseHeader header = 1;
}