/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016 ForgeRock AS. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt.
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file at legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
*/
/**
* Encapsulates the Crypto state for a published soap-sts instance. An instance of this class will be passed to the
* SoapSTSIntegrationTestModule to guide the SoapSTSKeystoreConfig created for published soap-sts instances in the
* SoapSTSInstanceConfigFactory. This class is an analogue to the SoapSTSClientCryptoState class. Both ultimately inform
* the CallbackHandler passed to the CXF runtime, which will be asked to provide the crypto context necessary to satisfy
* the SecurityPolicy bindings regulating access to published soap-sts instances.
*/
public class SoapSTSServerCryptoState {
public static class SoapSTSServerCryptoStateBuilder {
private SoapSTSServerCryptoStateBuilder() {}
/**
*
* @param keystoreLocation location of keystore, in classpath or filesystem
* @return builder
*/
this.keystoreLocation = keystoreLocation;
return this;
}
/**
*
* @param keystorePassword keystore password. Note for two-way TLS, the server's private key entry password,
* and the keystore password must be the same
* @return builder
*/
this.keystorePassword = keystorePassword;
return this;
}
/**
* In a asymmetric binding, messages from server to client will be encrypted with the server's public key, and thus
* he alias to the server's private key entry must be specified.
* @param decryptionKeyAlias alias of server's private key
* @return builder
*/
this.decryptionKeyAlias = decryptionKeyAlias;
return this;
}
/**
* In a asymmetric binding, messages from server to client will be encrypted with the server's public key, and thus
*the password to the server's private key entry must be specified.
* @param decryptionKeyPassword password to server's private key
* @return builder
*/
return this;
}
/**
* In a asymmetric binding, messages from server to client must be signed by the server's private key as identified
* by this alias.
* @param signatureKeyAlias alias to server's private key
* @return builder
*/
this.signatureKeyAlias = signatureKeyAlias;
return this;
}
/**
* In a asymmetric binding, messages from server to client must be signed by the server's private key - this is the
* password for the key alias immediately above
* @param signatureKeyPassword password for server's private key
* @return builder
*/
return this;
}
return new SoapSTSServerCryptoState(this);
}
}
}
return new SoapSTSServerCryptoStateBuilder();
}
return keystoreLocation;
}
return keystorePassword;
}
return decryptionKeyAlias;
}
return decryptionKeyPassword;
}
return signatureKeyAlias;
}
return signatureKeyPassword;
}
// the deployable soap-sts .war file will be created with the sts-example-server .jks packaged at root of
// classpath in .war file
return SoapSTSServerCryptoState.builder()
.keystoreLocation("sts-example-server.jks")
.keystorePassword("password")
.decryptionKeyAlias("sts-example-server")
.decryptionKeyPassword("password")
.signatureKeyAlias("sts-example-server")
.signatureKeyPassword("password")
.build();
}
}