Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 194... Línea 194...
194
        $cacheKey = $cacheKey ?: 'aws_cached_token';
194
        $cacheKey = $cacheKey ?: 'aws_cached_token';
Línea 195... Línea 195...
195
 
195
 
196
        return function () use ($provider, $cache, $cacheKey) {
196
        return function () use ($provider, $cache, $cacheKey) {
197
            $found = $cache->get($cacheKey);
197
            $found = $cache->get($cacheKey);
198
            if (is_array($found) && isset($found['token'])) {
198
            if (is_array($found) && isset($found['token'])) {
199
                if (isset($found['token']) && $found['token'] instanceof TokenInterface) {
199
                $foundToken = $found['token'];
200
                    $foundToken = $found['token'];
200
                if ($foundToken instanceof TokenInterface) {
201
                    if (!$foundToken->isExpired()) {
201
                    if (!$foundToken->isExpired()) {
202
                        return Promise\Create::promiseFor($foundToken);
202
                        return Promise\Create::promiseFor($foundToken);
203
                    }
203
                    }
204
                    if (isset($found['refreshMethod']) && is_callable($found['refreshMethod'])) {
204
                    if (isset($found['refreshMethod']) && is_callable($found['refreshMethod'])) {
Línea 251... Línea 251...
251
    }
251
    }
Línea 252... Línea 252...
252
 
252
 
253
    /**
253
    /**
254
     * Token provider that creates a token from cached sso credentials
254
     * Token provider that creates a token from cached sso credentials
255
     *
255
     *
256
     * @param string $ssoProfileName the name of the ini profile name
256
     * @param string $profileName the name of the ini profile name
257
     * @param string $filename the location of the ini file
257
     * @param string $filename the location of the ini file
258
     * @param array $config configuration options
258
     * @param array $config configuration options
259
     *
259
     *
260
     * @return SsoToken
260
     * @return SsoTokenProvider
261
     * @see Aws\Token\SsoToken for $config details.
261
     * @see Aws\Token\SsoTokenProvider for $config details.
262
     */
262
     */
263
    public static function sso($profileName, $filename, $config = [])
263
    public static function sso($profileName, $filename, $config = [])
-
 
264
    {
-
 
265
        $ssoClient = isset($config['ssoClient']) ? $config['ssoClient'] : null;
264
    {
266
 
265
        return new SsoTokenProvider($profileName, $filename, $config);
267
        return new SsoTokenProvider($profileName, $filename, $ssoClient);
266
    }
268
    }