> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# atoti.Session.user

#### *property* Session.user *: [User](./atoti.user#atoti.User)*

The user behind this session.

### Example

A session without security configured has a single user, who is both anonymous and an administrator:

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> user = session.user
>>> user.name
'anonymousUser'
>>> sorted(user.roles)
['ROLE_ADMIN', 'ROLE_ANONYMOUS', 'ROLE_USER']
```

The user that [`started`](./atoti.Session.start#atoti.Session.start) a secured session has the same characteristics:

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> session_config = tt.SessionConfig(security=tt.SecurityConfig())
>>> secured_session = tt.Session.start(session_config)
>>> root = secured_session.user
>>> root.name
'anonymousUser'
>>> sorted(root.roles)
['ROLE_ADMIN', 'ROLE_ANONYMOUS', 'ROLE_USER']
```

Adding a new user:

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> username, password = "Cooper", "abcdef123456"
>>> secured_session.security.individual_roles[username] = {
...     "ROLE_PILOT",
...     "ROLE_USER",
... }
>>> secured_session.security.basic_authentication.credentials[username] = (
...     password
... )
```

Connecting as this new user:

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> cooper_session = tt.Session.connect(
...     secured_session.url,
...     authentication=tt.BasicAuthentication(username, password),
... )
>>> cooper = cooper_session.user
>>> cooper.name
'Cooper'
>>> sorted(cooper.roles)
['ROLE_PILOT', 'ROLE_USER']
```
