Registration microservice using a triple store in the backend
2.4K
Registration microservice running on mu.semte.ch.
Add the following snippet to your docker-compose.yml to include the registration service in your project.
registration:
image: semtech/mu-registration-service:2.6.0
links:
- database:database
The triple store used in the backend is linked to the registration service container as database. If you configure another SPARQL endpoint URL through MU_SPARQL_ENDPOINT update the link name accordingly. Make sure the registration service is able to execute update queries against this store.
To strengthen the password hashing, you can configure an application wide salt through the MU_APPLICATION_SALT environment variable. This salt will be concatenated with a salt generated per user to hash the user passwords. By default the application wide salt is not set. If you configure this salt, make sure to configure the login microservice with the same salt.
The MU_AUTO_LOGIN_ON_REGISTRATION environment variable (default: false) specifies whether the new user should be logged in automatically at the end of the registration request.
The MU_APPLICATION_GRAPH environment variable (default: http://mu.semte.ch/application) specifies the graph in the triple store the login service will work in.
Add rules to the dispatcher.ex to dispatch requests to the registration service. E.g.
match "/accounts/*path" do
Proxy.forward conn, path, "http://registration/accounts/"
end
The host registration in the forward URL reflects the name of the registration service in the docker-compose.yml file as defined above.
More information how to setup a mu.semte.ch project can be found in mu-project.
Register a new account with the given nickname and password.
{
"data": {
"type": "accounts",
"attributes": {
"name": "John Doe",
"nickname": "john_doe",
"password": "secret",
"password-confirmation": "secret"
}
}
}
On successful registration with the newly created account in the response body:
{
"links": {
"self": "accounts/f6419af0-c90f-465f-9333-e993c43e6cf2"
},
"data": {
"type": "accounts",
"id": "f6419af0-c90f-465f-9333-e993c43e6cf2",
"attributes": {
"name": "John Doe",
"nickname": "john_doe"
}
}
}
Change the password of the current account, i.e. the account of the user that is currently logged in.
{
"data": {
"type": "accounts",
"id": "current",
"attributes": {
"old-password": "secret",
"new-password": "anotherSecret",
"new-password-confirmation": "anotherSecret"
}
}
}
On successful update of the account.
Unregister the current account, i.e. remove the account of the user that is currently logged in.
On successful unregistration.
If session header is missing or invalid. The header should be automatically set by the identifier.
Update the account details of the account with the given id.
{
"data": {
"type": "accounts",
"id": "f6419af0-c90f-465f-9333-e993c43e6cf2",
"attributes": {
"nickname": "john_doe",
"password": "anotherSecret"
}
}
}
On successful update of the account.
If an account with the given id doesn't exist.
Unregister the account with the given id. This function will be typically used by a system administrator.
On successful unregistration.
If an account with the given id doesn't exist.
Content type
Image
Digest
sha256:54faf92b7…
Size
407.2 MB
Last updated
about 1 year ago
docker pull semtech/mu-registration-service