@Test public void testEncrypt() throws Exception { String input = "AVeryGoodPassWd"; String pass = "******"; String secret = PwdCrypt.encode(input, pass); String output = PwdCrypt.decode(secret, pass); assertEquals(input, output); }
@Override public boolean configure(StaplerRequest req, JSONObject formData) throws hudson.model.Descriptor.FormException { serviceURL = formData.getString("serviceURL"); // $NON-NLS-1$ user = formData.getString("user"); // $NON-NLS-1$ password = PwdCrypt.encode( formData.getString("password"), Hudson.getInstance().getSecretKey()); // $NON-NLS-1$ save(); return super.configure(req, formData); }