# Access the secret

You need to log in to access the secret!
Try to access it using one of the following links to test access control powered by Authelia.

- public.example.com /
- secure.example.com / secret.html
- singlefactor.example.com / secret.html
- dev.example.com
  - Groups
    - / groups / admins / secret.html
    - / groups / dev / secret.html
  - Users
    - / users / john / secret.html
    - / users / harry / secret.html
    - / users / bob / secret.html
- admin.example.com / secret.html
- mx1.main.example.com / secret.html
- mx2.main.example.com / secret.html

You can also log off by visiting the following link.

# List of users

Here is the list of credentials you can log in with to test access control.
Once first factor is passed, you will need to follow the links to register a secret for the second factor.
Authelia will send you a fictitious email in a fake webmail at https://mail.example.com:8080/.
It will provide you with the link to complete the registration allowing you to authenticate with 2-factor.

- john / password: belongs to admin and dev groups.
- bob / password: belongs to dev group only.
- harry / password: does not belong to any group.

# Access control rules

These rules are extracted from the configuration file config.template.yml.

      default_policy: deny

      rules:
        # Rules applied to everyone
        - domain: public.example.com
          policy: two_factor
        - domain: singlefactor.example.com
          policy: one_factor

        # Rules applied to 'admins' group
        - domain: 'mx2.mail.example.com'
          subject: 'group:admins'
          policy: deny
        - domain: '*.example.com'
          subject: 'group:admins'
          policy: two_factor

        # Rules applied to 'dev' group
        - domain: dev.example.com
          resources:
            - '^/groups/dev/.*$'
          subject: 'group:dev'
          policy: two_factor

        # Rules applied to user 'john'
        - domain: dev.example.com
          resources:
            - '^/users/john/.*$'
          subject: 'user:john'
          policy: two_factor

        # Rules applied to user 'harry'
        - domain: dev.example.com
          resources:
            - '^/users/harry/.*$'
          subject: 'user:harry'
          policy: two_factor

        # Rules applied to user 'bob'
        - domain: '*.mail.example.com'
          subject: 'user:bob'
          policy: two_factor
        - domain: 'dev.example.com'
          resources:
            - '^/users/bob/.*$'
          subject: 'user:bob'
          policy: two_factor