flowserv.service.user.remote module

Implementation of user service API methods that access and manipulate user resources as well as access tokens. This implementation provides access to flowserv objects via a remote RESTful API.

class flowserv.service.user.remote.RemoteUserService(descriptor: flowserv.service.descriptor.ServiceDescriptor, labels: Optional[Dict] = None)

Bases: flowserv.service.user.base.UserService

HTTP client for a RESTful API to access flowserv API resources.

activate_user(user_id: str) Dict

Activate a new user with the given identifier.

Parameters

user_id (string) – Unique user name

Return type

dict

list_users(query: Optional[str] = None) Dict

Get a listing of registered users. The optional query string is used to filter users whose name starts with the given string.

Parameters

query (string, default=None) – Prefix string to filter users based on their name.

Return type

dict

login_user(username: str, password: str) Dict

Get handle for user with given credentials. Raises error if the user is unknown or if invalid credentials are provided.

Parameters
  • username (string) – Unique name of registered user

  • password (string) – User password (in plain text)

Return type

dict

logout_user(api_key: str) Dict

Logout given user.

Parameters

api_key (string) – API key for user that is being logged out.

Return type

dict

register_user(username: str, password: str, verify: Optional[bool] = False) Dict

Create a new user for the given username and password. Raises an error if a user with that name already exists or if the user name is ivalid (e.g., empty or too long).

Returns success object if user was registered successfully.

Parameters
  • username (string) – User email address that is used as the username

  • password (string) – Password used to authenticate the user

  • verify (bool, default=False) – Determines whether the created user is active or inactive

Return type

dict

request_password_reset(username: str) Dict

Request to reset the password for the user with the given name. The result contains a unique request identifier for the user to send along with their new password.

Parameters

username (string) – Unique user login name

reset_password(request_id: str, password: str) Dict

Reset the password for the user that made the given password reset request. Raises an error if no such request exists or if the request has timed out.

Returns the serialization of the user handle.

Parameters
  • request_id (string) – Unique password reset request identifier

  • password (string) – New user password

Return type

dict

whoami_user(api_key: str) Dict

Get serialization of the given user.

Parameters

api_key (string) – API key for a logged-in user.

Return type

dict