org.seedstack.seed.security.principals.X509CertificatePrincipalProvider Maven / Gradle / Ivy
/**
* Copyright (c) 2013-2016, The SeedStack authors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.security.principals;
import java.io.Serializable;
import java.security.cert.X509Certificate;
/**
* Principal provider that stores the user X509Certificates used for his
* authentication.
*
* @author [email protected]
*/
public class X509CertificatePrincipalProvider implements PrincipalProvider, Serializable {
private static final long serialVersionUID = -437306763922586396L;
private X509Certificate[] certificates;
/**
* Constructor
*
* @param x509Certificates the user certificates.
*/
public X509CertificatePrincipalProvider(X509Certificate[] x509Certificates) {
if (x509Certificates == null) {
this.certificates = null;
} else {
this.certificates = x509Certificates.clone();
}
}
@Override
public X509Certificate[] getPrincipal() {
if (certificates == null) {
return null;
}
return certificates.clone();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy