Search in sources :

Example 6 with X509CertificateGenerator

use of com.thoughtworks.go.security.X509CertificateGenerator in project gocd by gocd.

the class AgentInstance method assignCertification.

public Registration assignCertification() {
    if (AgentConfigStatus.Pending.equals(agentConfigStatus)) {
        return Registration.createNullPrivateKeyEntry();
    }
    X509CertificateGenerator certificateGenerator = new X509CertificateGenerator();
    Registration entry = certificateGenerator.createAgentCertificate(new SystemEnvironment().agentkeystore(), agentConfig.getHostname());
    return new Registration(entry.getPrivateKey(), entry.getChain());
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) Registration(com.thoughtworks.go.security.Registration) X509CertificateGenerator(com.thoughtworks.go.security.X509CertificateGenerator)

Example 7 with X509CertificateGenerator

use of com.thoughtworks.go.security.X509CertificateGenerator in project gocd by gocd.

the class AgentCertificateMother method agentCertificate.

public static Registration agentCertificate(TemporaryFolder temporaryFolder) throws IOException {
    File tempKeystoreFile = temporaryFolder.newFile();
    X509CertificateGenerator certificateGenerator = new X509CertificateGenerator();
    certificateGenerator.createAndStoreCACertificates(tempKeystoreFile);
    return certificateGenerator.createAgentCertificate(tempKeystoreFile, "blah");
}
Also used : File(java.io.File) X509CertificateGenerator(com.thoughtworks.go.security.X509CertificateGenerator)

Aggregations

X509CertificateGenerator (com.thoughtworks.go.security.X509CertificateGenerator)7 File (java.io.File)2 X509Certificate (java.security.cert.X509Certificate)2 Test (org.junit.Test)2 Registration (com.thoughtworks.go.security.Registration)1 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)1 BadCredentialsException (org.springframework.security.BadCredentialsException)1 GrantedAuthority (org.springframework.security.GrantedAuthority)1 GrantedAuthorityImpl (org.springframework.security.GrantedAuthorityImpl)1 UserDetails (org.springframework.security.userdetails.UserDetails)1