예제 #1
0
        public Saml2AuthResponse Validate(string samlResponse)
        {
            var authId = authStateAccessor.Id;

            if (string.IsNullOrEmpty(authId?.Value))
            {
                log.LogInformation("SAML auth state was not initialized");
                return(new Saml2AuthResponse(false));
            }

            var idpCertificate     = certificateStore.LoadCertificate(config.Saml2IdpCertificate);
            var serviceCertificate = certificateStore.LoadCertificate(config.Saml2Certificate);
            var issuer             = new EntityId(config.Saml2IdpEntityId);
            var localEntityId      = new EntityId(config.Saml2EntityId);
            var saml2Response      = Saml2AuthResponse.Create(samlResponse, authId, issuer, idpCertificate, serviceCertificate, localEntityId);

            return(saml2Response);
        }
예제 #2
0
        private void InitServerAndClient()
        {
            var keyStore = _certificateStore.LoadKeyStore("test");
            var cert     = _certificateStore.LoadCertificate("test");
            var keyCert  = new KeyCertificatePair(cert, keyStore);

            _server.StartAsync(Host, ListenPort).Wait();

            string uri = $"{Host}:{ListenPort}";

            parentClient = new GrpcClientForParentChain(uri, 0, 1);
            sideClient   = new GrpcClientForSideChain(uri, 1);
        }
예제 #3
0
        private X509Certificate2 LoadCertificate()
        {
            var certPath = config.Saml2Certificate;

            return(certificateStore.LoadCertificate(certPath));
        }