Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 12... Línea 12...
12
/**
12
/**
13
 * Generates RDS auth tokens for use with IAM authentication.
13
 * Generates RDS auth tokens for use with IAM authentication.
14
 */
14
 */
15
class AuthTokenGenerator
15
class AuthTokenGenerator
16
{
16
{
17
 
-
 
18
    private $credentialProvider;
17
    private $credentialProvider;
Línea 19... Línea 18...
19
 
18
 
20
    /**
19
    /**
21
     * The constructor takes an instance of Credentials or a CredentialProvider
20
     * The constructor takes an instance of Credentials or a CredentialProvider
Línea 45... Línea 44...
45
     */
44
     */
46
    public function createToken($endpoint, $region, $username, $lifetime = 15)
45
    public function createToken($endpoint, $region, $username, $lifetime = 15)
47
    {
46
    {
48
        if (!is_numeric($lifetime) || $lifetime > 15 || $lifetime <= 0) {
47
        if (!is_numeric($lifetime) || $lifetime > 15 || $lifetime <= 0) {
49
            throw new \InvalidArgumentException(
48
            throw new \InvalidArgumentException(
50
                "Lifetime must be a positive number less than or equal to 15, was {$lifetime}",
49
                "Lifetime must be a positive number less than or equal to 15, was {$lifetime}"
51
                null
-
 
52
            );
50
            );
53
        }
51
        }
Línea 54... Línea 52...
54
 
52
 
55
        $uri = new Uri($endpoint);
53
        $uri = new Uri($endpoint);