Skip to content

Commit

Permalink
merge conflict resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed May 30, 2021
2 parents 6031f5a + 4a5a933 commit 0fbd9c2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
45 changes: 40 additions & 5 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Compiled-in authenticator names may be changed by using `logical_names` configur

When a new account is created, the user must inform the server which authentication method will be later used to gain access to this account as well as provide shared secret, if appropriate. Only `basic` and `anonymous` can be used during account creation. The `basic` requires the user to generate and send a unique login and password to the server. The `anonymous` does not exchange secrets.

User may optionally set `{acc login=true}` to use the new account for immediate authentication. When `login=false` (or not set), the new account is created but the authentication status of the session which created the account remains unchanged. When `login=true` the server will attempt to authenticate the session with the new account, the response to the `{acc}` request will contain the authentication token on success. This is particularly important for the `anonymous` authentication.
User may optionally set `{acc login=true}` to use the new account for immediate authentication. When `login=false` (or not set), the new account is created but the authentication status of the session which created the account remains unchanged. When `login=true` the server will attempt to authenticate the session with the new account, the `{ctrl}` response to the `{acc}` request will contain the authentication token on success. This is particularly important for the `anonymous` authentication because that's the only time when the authentication token can be retrieved.

#### Logging in

Expand Down Expand Up @@ -445,7 +445,42 @@ Topics and subscriptions have `public` and `private` fields. Generally, the fiel

### Public

The format of the `public` field in group, peer to peer, systems topics is expected to be [theCard](./thecard.md).
```js
{
fn: "John Doe", // string, formatted name
n: {
surname: "Miner", // last of family name
given: "Coal", // first or given name
additional: "Diamond", // additional name, such as middle name or patronymic or nickname.
prefix: "Dr.", // prefix, such as honorary title or gender designation.
suffix: "Jr.", // suffix, such as 'Jr' or 'II'
}, // object, user's structured name
org: "Most Evil Corp", // string, name of the organisation the user belongs to.
title: "CEO", // string, job title
tel: [
{
type: "HOME", // string, optional designation
uri: "tel:+17025551234" // string, phone number
}, ...
], // array of objects, list of phone numbers associated with the user
email: [
{
type: "WORK", // string, optional designation
uri: "email:alice@example.com", // string, email address
}, ...
], // array of objects, list of user's email addresses
impp: [
{
type: "OTHER",
uri: "tinode:usrRkDVe0PYDOo", // string, email address
}, ...
], // array of objects, list of user's IM handles
photo: {
type: "jpeg", // image type
data: "..." // base64-encoded binary image data
} // object, avatar photo. Java does not have a useful bitmap class, so keeping it as bits here.
}
```

The `fnd` topic expects `public` to be a string representing a [search query](#query-language)).

Expand Down Expand Up @@ -624,7 +659,8 @@ The `{acc}` message **cannot** be used to modify `desc` or `cred` of an existing
```js
acc: {
id: "1a2b3", // string, client-provided message id, optional
user: "new", // string, "new" to create a new user, default: current user, optional
user: "newABC123", // string, "new" optionally followed by any characters to create a new user,
// default: current user, optional
token: "XMgS...8+BO0=", // string, authentication token to use for the request if the
// session is not authenticated, optional
status: "ok", // change user's status; no default value, optional.
Expand Down Expand Up @@ -664,8 +700,7 @@ acc: {
}
```

Server responds with a `{ctrl}` message with `params` containing details of the new user. If `desc.defacs` is missing,
server will assign server-default access values.
Server responds with a `{ctrl}` message with `params` containing details of the new user account such as user ID and, in case of `login: true`, authentication token. If `desc.defacs` is missing, the server will assign server-default access permissions to new account.

The only supported authentication schemes for account creation are `basic` and `anonymous`.

Expand Down
3 changes: 2 additions & 1 deletion server/auth/rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ Add the following section to the `auth_config` in [tinode.conf](../../tinode.con
"auth_config": {
...
"rest": {
// ServerUrl is the URL of the authentication server to call.
// ServerUrl is the URL of the authentication server to call. The URL must be absolute:
// it must include the scheme, such as http or https, and the host name.
"server_url": "http://127.0.0.1:5000/",
// Authentication server is allowed to create new accounts.
"allow_new_accounts": true,
Expand Down
2 changes: 2 additions & 0 deletions tn-cli/tn-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,8 @@ def gen_message(scheme, secret, args):

if tn_globals.IsInteractive:
time.sleep(0.1)
else:
time.sleep(0.01)

except Exception as err:
stdoutln("Exception in generator: {0}".format(err))
Expand Down

0 comments on commit 0fbd9c2

Please sign in to comment.