示例#1
0
        async Task <D2LSecurityToken> IPublicKeyProvider.GetByIdAsync(Guid id)
        {
            D2LSecurityToken result = m_cache.Get(m_jwksProvider.Namespace, id);

            if (result != null)
            {
                return(result);
            }

            JsonWebKeySet jwks = await m_jwksProvider
                                 .RequestJwksAsync()
                                 .SafeAsync();

            CacheJwks(m_cache, m_jwksProvider.Namespace, jwks);

            result = m_cache.Get(m_jwksProvider.Namespace, id);
            if (result != null)
            {
                return(result);
            }

            throw new PublicKeyNotFoundException(id, jwks.Source.AbsoluteUri);
        }