aboutsummaryrefslogtreecommitdiff
path: root/Psso/Identity.php
blob: a06f57ef491e34566f74a5f069b88622a6ecb40f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Psso;

class Identity {
    public protected(set) string $user;
    public protected(set) array $groups;
    public array $extras;

    public function __construct(
        string $user, array $groups = [], array $extras = []
    ) {
        $this->user = $user;
        $this->groups = $groups;
        $this->extras = $extras;
    }

    public static function fromContext(Context $context) {
        return new static($context->user, $context->groups, $context->extras);
    }
}