File size: 907 Bytes
cf14c12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php

declare(strict_types=1);

namespace User\Infrastructure\SSO;

use Psr\Http\Message\UriInterface;
use User\Domain\Entities\UserEntity;
use User\Infrastructure\SSO\Exceptions\InvalidCodeException;

interface IdentityProviderInterface
{
    /** 
     * Get name of the identity provider. Will be shown in the UI.
     * 
     * @return string
     */
    public function getName(): string;

    /**
     * Get icon source of the identity provider. Will be shown in the UI.
     * @return string
     */
    public function getIconSrc(): string;

    /**
     * Get the URL to redirect to for authentication.
     * @return UriInterface
     */
    public function getAuthUrl(): UriInterface;

    /**
     * @param string $code
     * @param array $params
     * @return UserEntity
     * @throws InvalidCodeException
     */
    public function getUser(string $code, array $params = []): UserEntity;
}