<commit_before>User API
========

.. http:post:: /user/(user_name)/credentials

	Send user credentials to receive an Authorization token.

	**Example request**:

	.. sourcecode:: http

		POST /user/root/credentials HTTP/1.1
		Host: example.com
		Accept: application/json
		Content-Type: application/json

		{
			"type": "password",
			"password": "<PASSWORD>"
		}

	**Example response**:

	.. sourcecode:: http

		HTTP/1.1 200 OK
		Content-Type: application/json

		{
			"Authorization": "dEFFEFeddedeGGEGMceokr353521234"
		}

	:param user_name: the username

	:statuscode 200: no error, credentials accepted
	:statuscode 401: unauthorized, either the username does not exist or the credentials
	                 were incorrect<commit_msg>extend documentation of POST /user/(user_name)/credential<commit_after>User API
========

.. http:post:: /user/(user_name)/credentials

	Send user credentials to receive an authorization token.

	The returned authorization token can be used in subsequent :http:header:`Authorization`
	headers for accessing protected resources.

	**Example request**:

	.. sourcecode:: http

		POST /user/root/credentials HTTP/1.1
		Host: example.com
		Accept: application/json
		Content-Type: application/json

		{
			"method": "plain",
			"password": "<PASSWORD>"
		}

	**Example response**:

	.. sourcecode:: http

		HTTP/1.1 200 OK
		Content-Type: application/json

		{
			"Authorization": "dEFFEFeddedeGGEGMceokr353521234"
		}

	:param user_name: The username.

	:<json method: The credential method. Please refer to :ref:`user-credentials` for a
	               list of supported methods.

	:>json Authorization: The authorization token, which can be used in the
	                      :http:header:`Authorization` header for subsequent requests.

	:statuscode 200: No error, credentials accepted.
	:statuscode 400: The request was malformed; the provided fields could not be understood.
	:statuscode 401: Unauthorized, either the username does not exist or the credentials
	                 were incorrect.

.. _user-credentials:

Credentials
-----------

.. 
	TODO "will support", update as soon as other methods are available
	like key derivation methods

:term:`paymentd` will support multiple methods for accepting and authenticating
credentials.

Currently the following types are available:

+-----------+-------------------------+
|    Type   |       Description       |
+===========+=========================+
| ``plain`` | Password in plain text. |
+-----------+-------------------------+


{'fraction_non_alphanumeric': 0.14477848101265822, 'fraction_numerical': 0.018591772151898733, 'mean_word_length': 3.1121951219512196, 'pattern_counts': {'":': 6, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '663836', 'n_tokens_mistral': 777, 'n_tokens_neox': 674, 'n_words': 230}