Contributte Security

Content

Setup

composer require contributte/security
1

Authenticators

DebugAuthenticator

services:
    security.authenticator: Contributte\Security\Auth\DebugAuthenticator(true/false)
1
2

StaticAuthenticator

services:
    security.authenticator: Contributte\Security\Auth\StaticAuthenticator([
        "john@doe.net":
            # password generated through Nette\Security\Passwords::hash()
            password: $2y$10$fn.Y.EyNIaQwp1laEQskUOywXDbahvZ9xjWVaEQ4u2rDFj87F/YKO
            identity: [
                id: john@doe.net
                roles: [user, roles]
                data: [custom, data]
            ]
    ])
1
2
3
4
5
6
7
8
9
10
11

Usage without password hashing

services:
    security.authenticator: Contributte\Security\Auth\StaticAuthenticator([
        "john@doe.net":
            # plain password
            password: foobar
            # check password as plain string
            unsecured: true
            identity: [
                id: john@doe.net
                roles: [user, roles]
                data: [custom, data]
            ]
    ])
1
2
3
4
5
6
7
8
9
10
11
12
13

**Usage with custom Nette\Security\IIdentity implementation **

services:
    security.authenticator: Contributte\Security\Auth\StaticAuthenticator([
        "john@doe.net":
            password: $2y$10$fn.Y.EyNIaQwp1laEQskUOywXDbahvZ9xjWVaEQ4u2rDFj87F/YKO
            identity: My\Own\Identity(
                john@doe.net,
                [user, roles],
                [custom, data]
            )
    ])
1
2
3
4
5
6
7
8
9
10