X509Certificate certificate = getCertificate(); UserCredential credential = new CertificateCredential(certificate);
This section describes how to authenticate users using the X509 certificates as credentials.
This authentication type is provided by the org.picketbox.core.authentication.impl.CertificateAuthenticationMechanism.
You do not need any specific configuration to use this mechanism, it is already configured when you start PicketBox.
This mechanism supports the following credential:
org.picketbox.core.authentication.credential.CertificateCredential
The code bellow demonstrates how to create this credential type.
X509Certificate certificate = getCertificate(); UserCredential credential = new CertificateCredential(certificate);
PicketBoxManager picketBoxManager = createManager(); UserContext authenticatingContext = new UserContext(); X509Certificate certificate = getCertificate(); UserCredential credential = new CertificateCredential(certificate); authenticatingContext.setCredential(credential); UserContext authenticatedContext = picketBoxManager.authenticate(authenticatingContext); assertNotNull(authenticatedContext); assertNotNull(authenticatedContext.isAuthenticated());