{"id":21192174,"url":"https://github.com/mu-semtech/registration-service","last_synced_at":"2025-07-10T03:31:28.680Z","repository":{"id":30461666,"uuid":"34015546","full_name":"mu-semtech/registration-service","owner":"mu-semtech","description":"Registration microservice","archived":false,"fork":false,"pushed_at":"2023-02-13T18:26:24.000Z","size":58,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-05T10:22:04.652Z","etag":null,"topics":["microservice","mu-service","musemtech","user-registration"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mu-semtech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-15T19:58:40.000Z","updated_at":"2023-01-31T10:48:19.000Z","dependencies_parsed_at":"2023-02-15T07:32:04.001Z","dependency_job_id":null,"html_url":"https://github.com/mu-semtech/registration-service","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/mu-semtech/registration-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mu-semtech%2Fregistration-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mu-semtech%2Fregistration-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mu-semtech%2Fregistration-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mu-semtech%2Fregistration-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mu-semtech","download_url":"https://codeload.github.com/mu-semtech/registration-service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mu-semtech%2Fregistration-service/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264521166,"owners_count":23622096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["microservice","mu-service","musemtech","user-registration"],"created_at":"2024-11-20T19:07:48.765Z","updated_at":"2025-07-10T03:31:23.662Z","avatar_url":"https://github.com/mu-semtech.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Registration microservice\nRegistration microservice running on [mu.semte.ch](http://mu.semte.ch).\n\n## How-To\n### Add the registration service to a stack\n\nAdd the following snippet to your `docker-compose.yml` to include the registration service in your project.\n\n```yaml\nregistration:\n  image: semtech/mu-registration-service:2.7.3\n  links:\n    - database:database\n```\n\nThe triple store used in the backend is linked to the registration service container as `database`.\n\nNext, add the following rules to the `dispatcher.ex` to dispatch requests to the registration service. E.g.\n\n```elixir\n  match \"/accounts/*path\", @any do\n    Proxy.forward conn, path, \"http://registration/accounts/\"\n  end\n```\n\nThe host `registration` in the forward URL reflects the name of the registration service in the `docker-compose.yml` file as defined above.\n\nMore information how to setup a mu.semte.ch project can be found in [mu-project](https://github.com/mu-semtech/mu-project).\n\n### Generate a new user/account\nThe registration service provides an interactive script to generate a new user and account using [mu-cli](https://github.com/mu-semtech/mu-cli). Execute the following command, enter the required information and insert the generated data in the triplestore.\n\n```bash\nmu script registration generate-account\n```\n\n## Tutorials\nA tutorial using this repository can be found at https://github.com/mu-semtech/mu-project#adding-authentication-to-your-mu-project\n\n## Reference\n### Configuration\nThe following enviroment variables can be set on the registration service:\n\n- **USERS_GRAPH** : graph in which the person and account resources will be stored. E.g. `http://mu.semte.ch/graphs/users`. Defaults to `http://mu.semte.ch/application`.\n- **SESSIONS_GRAPH** : graph in which the session resources will be stored. E.g. `http://mu.semte.ch/graphs/sessions`. Defaults to `http://mu.semte.ch/application`.\n- **MU_APPLICATION_SALT** : strengthen the password hashing by configuring an application wide salt. 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](https://github.com/mu-semtech/login-service) with the same salt. Setting the salt makes account resources non-shareable with stacks containing a login-service configured with another salt.\n- **MU_AUTO_LOGIN_ON_REGISTRATION**: whether a new user should automatically be logged in after a succesful registration request  (default: `false`).\n\n### Model\nThis section describes the minimal required model for the login service. These models can be enriched with additional properties and/or relations.\n\nThe graphs is which the resources are stored, can be configured via environment variables.\n\n#### Used prefixes\n| Prefix  | URI                                      |\n|---------|------------------------------------------|\n| mu      | http://mu.semte.ch/vocabularies/core/    |\n| account | http://mu.semte.ch/vocabularies/account/ |\n| session | http://mu.semte.ch/vocabularies/session/ |\n| foaf    | http://xmlns.com/foaf/0.1/               |\n| dct     | http://purl.org/dc/terms/                |\n\n#### Persons\n##### Class\n`foaf:Person`\n\n##### Properties\n| Name     | Predicate      | Range                | Definition                                    |\n|----------|----------------|----------------------|-----------------------------------------------|\n| name     | `foaf:name`    | `xsd:string`         | Name of the person                            |\n| created  | `dct:created`  | `xsd:dateTime`       | Creation date of the person resource          |\n| modified | `dct:modified` | `xsd:dateTime`       | Last modification date of the person resource |\n| account  | `foaf:account` | `foaf:OnlineAccount` | Account linked to the person                  |\n\n#### Accounts\n##### Class\n`foaf:OnlineAccount`\n\n##### Properties\n| Name        | Predicate          | Range           | Definition                                                                                                                            |\n|-------------|--------------------|-----------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| accountName | `foaf:accountName` | `xsd:string`    | Account name / nickname                                                                                                               |\n| password    | `account:password` | `xsd:string`    | Hashed password of the account                                                                                                        |\n| salt        | `account:salt`     | `xsd:string`    | Salt used to hash the password                                                                                                        |\n| status      | `account:status`   | `rdfs:Resource` | Status of the account. Only active (`\u003chttp://mu.semte.ch/vocabularies/account/status/active\u003e`) accounts are taken into account on login. |\n| created  | `dct:created`  | `xsd:dateTime`       | Creation date of the person resource          |\n| modified | `dct:modified` | `xsd:dateTime`       | Last modification date of the person resource |\n\n#### Sessions\n##### Class\nNone\n\n##### Properties\n| Name    | Predicate         | Range                | Definition                     |\n|---------|-------------------|----------------------|--------------------------------|\n| account | `session:account` | `foaf:OnlineAccount` | Account related to the session |\n\n\n### API\n#### POST /accounts\nRegister a new account with the given nickname and password.\n\n##### Request body\n```javascript\n{\n  \"data\": {\n    \"type\": \"accounts\",\n    \"attributes\": {\n      \"name\": \"John Doe\",\n      \"nickname\": \"john_doe\",\n      \"password\": \"secret\",\n      \"password-confirmation\": \"secret\"\n    }\n  }\n}\n```\n\n##### Response\n###### 201 Created\nOn successful registration with the newly created account in the response body:\n\n```javascript\n{\n  \"links\": {\n    \"self\": \"accounts/f6419af0-c90f-465f-9333-e993c43e6cf2\"\n  },\n  \"data\": {\n    \"type\": \"accounts\",\n    \"id\": \"f6419af0-c90f-465f-9333-e993c43e6cf2\",\n    \"attributes\": {\n      \"name\": \"John Doe\",\n      \"nickname\": \"john_doe\"\n    }\n  }\n}\n```\n\n###### 400 Bad Request\n- if session header is missing. The header should be automatically set by the [identifier](https://github.com/mu-semtech/mu-identifier).\n- if the request body is invalid.\n- if the given nickname already exists.\n\n\n\n#### PATCH /accounts/current/changePassword\nChange the password of the current account, i.e. the account of the user that is currently logged in.\n\n##### Request body\n```javascript\n{\n  \"data\": {\n    \"type\": \"accounts\",\n    \"id\": \"current\",\n    \"attributes\": {\n      \"old-password\": \"secret\",\n      \"new-password\": \"anotherSecret\",\n      \"new-password-confirmation\": \"anotherSecret\"\n    }\n  }\n}\n```\n\n##### Response\n###### 204 No Content\nOn successful update of the account.\n\n###### 400 Bad Request\n- if session header is missing. The header should be automatically set by the [identifier](https://github.com/mu-semtech/mu-identifier).\n- if the old password is incorrect.\n- if new password and new password confirmation do not match.\n- if the account is inactive.\n\n\n\n#### DELETE /accounts/current\nUnregister the current account, i.e. remove the account of the user that is currently logged in.\n\n##### Response\n###### 204 No Content\nOn successful unregistration.\n\n###### 400 Bad Request\nIf session header is missing or invalid. The header should be automatically set by the [identifier](https://github.com/mu-semtech/mu-identifier).\n\n\n\n\n#### PATCH /accounts/:id\nUpdate the account details of the account with the given id.\n\n##### Request body\n```javascript\n{\n  \"data\": {\n    \"type\": \"accounts\",\n    \"id\": \"f6419af0-c90f-465f-9333-e993c43e6cf2\",\n    \"attributes\": {\n      \"nickname\": \"john_doe\",\n      \"password\": \"anotherSecret\"\n    }\n  }\n}\n```\n\n##### Response\n###### 204 No Content\nOn successful update of the account.\n\n###### 400 Bad Request\n- if the account is inactive.\n- if the updated nickname already exists\n\n###### 404 Not Found\nIf an account with the given id doesn't exist.\n\n\n\n#### DELETE /accounts/:id\nUnregister the account with the given id. This function will be typically used by a system administrator.\n##### Response\n###### 204 No Content\nOn successful unregistration.\n\n###### 404 Not Found\nIf an account with the given id doesn't exist.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmu-semtech%2Fregistration-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmu-semtech%2Fregistration-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmu-semtech%2Fregistration-service/lists"}