Last change
on this file since 3831 was
3771,
checked in by gkronber, 14 years ago
|
Prepared deployment service proxy classes for migration of deployment server to a production environment. #989
|
File size:
1.1 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Security.Cryptography.X509Certificates;
|
---|
6 | using System.IdentityModel.Selectors;
|
---|
7 | using System.IdentityModel.Tokens;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.PluginInfrastructure.Advanced.DeploymentService {
|
---|
10 | internal class DeploymentServerCertificateValidator : X509CertificateValidator {
|
---|
11 | private X509Certificate2 allowedCertificate;
|
---|
12 | public DeploymentServerCertificateValidator(X509Certificate2 allowedCertificate) {
|
---|
13 | if (allowedCertificate == null) {
|
---|
14 | throw new ArgumentNullException("allowedCertificate");
|
---|
15 | }
|
---|
16 |
|
---|
17 | this.allowedCertificate = allowedCertificate;
|
---|
18 | }
|
---|
19 | public override void Validate(X509Certificate2 certificate) {
|
---|
20 | // Check that there is a certificate.
|
---|
21 | if (certificate == null) {
|
---|
22 | throw new ArgumentNullException("certificate");
|
---|
23 | }
|
---|
24 |
|
---|
25 | // Check that the certificate issuer matches the configured issuer
|
---|
26 | if (!allowedCertificate.Equals(certificate)) {
|
---|
27 | throw new SecurityTokenValidationException("Server certificate doesn't match.");
|
---|
28 | }
|
---|
29 | }
|
---|
30 | }
|
---|
31 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.