Latest release: v0.2

Security

Content

Usage

As with any other extension, you need to register it.

extensions:
    secured: Contributte\Security\DI\SecurityExtension
1
2

Configuration

secured:
    debug: %debugMode%
1
2

Authentication

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
12

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
14

**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