Last change
on this file since 6593 was
4068,
checked in by swagner, 14 years ago
|
Sorted usings and removed unused usings in entire solution (#1094)
|
File size:
1.1 KB
|
Rev | Line | |
---|
[3771] | 1 | using System;
|
---|
| 2 | using System.IdentityModel.Selectors;
|
---|
| 3 | using System.IdentityModel.Tokens;
|
---|
[4068] | 4 | using System.Security.Cryptography.X509Certificates;
|
---|
[3771] | 5 |
|
---|
| 6 | namespace HeuristicLab.PluginInfrastructure.Advanced.DeploymentService {
|
---|
| 7 | internal class DeploymentServerCertificateValidator : X509CertificateValidator {
|
---|
| 8 | private X509Certificate2 allowedCertificate;
|
---|
| 9 | public DeploymentServerCertificateValidator(X509Certificate2 allowedCertificate) {
|
---|
| 10 | if (allowedCertificate == null) {
|
---|
| 11 | throw new ArgumentNullException("allowedCertificate");
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | this.allowedCertificate = allowedCertificate;
|
---|
| 15 | }
|
---|
| 16 | public override void Validate(X509Certificate2 certificate) {
|
---|
| 17 | // Check that there is a certificate.
|
---|
| 18 | if (certificate == null) {
|
---|
| 19 | throw new ArgumentNullException("certificate");
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | // Check that the certificate issuer matches the configured issuer
|
---|
| 23 | if (!allowedCertificate.Equals(certificate)) {
|
---|
| 24 | throw new SecurityTokenValidationException("Server certificate doesn't match.");
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.