public static Protector createInitializedProtector(PrismContext prismContext) { return KeyStoreBasedProtectorBuilder.create(prismContext) .keyStorePath(MidPointTestConstants.KEYSTORE_PATH) .keyStorePassword(MidPointTestConstants.KEYSTORE_PASSWORD) .initialize(); }
private Protector createProtector() { return KeyStoreBasedProtectorBuilder.create(getPrismContext()) .keyStorePassword(KEYSTORE_PASSWORD) .keyStorePath(KEYSTORE_PATH) .encryptionAlgorithm(XMLCipher.AES_256) .initialize(); }
public static Protector createProtector(String xmlCipher){ return KeyStoreBasedProtectorBuilder.create(getPrismContext()) .keyStorePassword(KEYSTORE_PASSWORD) .keyStorePath(KEYSTORE_PATH) .encryptionAlgorithm(xmlCipher) .initialize(); } }
@BeforeClass public void setupFactory() { System.out.println("Setting up expression factory and evaluator"); PrismContext prismContext = getPrismContext(); ObjectResolver resolver = new DirectoryFileObjectResolver(OBJECTS_DIR); Protector protector = KeyStoreBasedProtectorBuilder.create(prismContext).buildOnly(); Clock clock = new Clock(); Collection<FunctionLibrary> functions = new ArrayList<>(); functions.add(FunctionLibraryUtil.createBasicFunctionLibrary(prismContext, protector, clock)); scriptExpressionfactory = new ScriptExpressionFactory(prismContext, protector, null); scriptExpressionfactory.setObjectResolver(resolver); scriptExpressionfactory.setFunctions(functions); evaluator = new Jsr223ScriptEvaluator("groovy", prismContext, protector, LocalizationTestUtil.getLocalizationService()); String languageUrl = evaluator.getLanguageUrl(); scriptExpressionfactory.registerEvaluator(languageUrl, evaluator); }
private Protector createCompromisedProtector() { return KeyStoreBasedProtectorBuilder.create(getPrismContext()) .keyStorePassword(KEYSTORE_PASSWORD) .keyStorePath(KEYSTORE_PATH) .encryptionKeyAlias("compromised") .encryptionAlgorithm(XMLCipher.AES_256) .initialize(); }
@BeforeClass public void setupFactory() { PrismContext prismContext = PrismTestUtil.getPrismContext(); ObjectResolver resolver = new DirectoryFileObjectResolver(OBJECTS_DIR); Protector protector = KeyStoreBasedProtectorBuilder.create(prismContext).buildOnly(); Clock clock = new Clock(); Collection<FunctionLibrary> functions = new ArrayList<>(); functions.add(FunctionLibraryUtil.createBasicFunctionLibrary(prismContext, protector, clock)); scriptExpressionfactory = new ScriptExpressionFactory(prismContext, protector, null); scriptExpressionfactory.setObjectResolver(resolver); scriptExpressionfactory.setFunctions(functions); localizationService = LocalizationTestUtil.getLocalizationService(); evaluator = createEvaluator(prismContext, protector); String languageUrl = evaluator.getLanguageUrl(); System.out.println("Expression test for "+evaluator.getLanguageName()+": registering "+evaluator+" with URL "+languageUrl); scriptExpressionfactory.registerEvaluator(languageUrl, evaluator); }
@BeforeSuite public void setup() throws SchemaException, SAXException, IOException { PrettyPrinter.setDefaultNamespacePrefix(MidPointConstants.NS_MIDPOINT_PUBLIC_PREFIX); PrismTestUtil.resetPrismContext(MidPointPrismContextFactory.FACTORY); protector = KeyStoreBasedProtectorBuilder.create(getPrismContext()) .keyStorePath("src/test/resources/keystore.jceks") .keyStorePassword("changeit") .initialize(); clock = new Clock(); }