use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class AuthenticationManagerTest method testCustomJAASLoginModuleOptions.
@Test
public void testCustomJAASLoginModuleOptions() throws Exception {
Properties props = TestEngine.getTestProperties();
// Supply a custom LoginModule options
props.put("jspwiki.loginModule.options.key1", "value1");
props.put("jspwiki.loginModule.options.key2", "value2");
props.put("jspwiki.loginModule.options.key3", "value3");
// Init the engine and verify that we initialized with the correct
// options
WikiEngine engine = new TestEngine(props);
AuthenticationManager authMgr = engine.getAuthenticationManager();
Map<String, String> options = authMgr.m_loginModuleOptions;
Assert.assertEquals(3, options.size());
Assert.assertTrue(options.containsKey("key1"));
Assert.assertTrue(options.containsKey("key2"));
Assert.assertTrue(options.containsKey("key3"));
Assert.assertEquals("value1", options.get("key1"));
Assert.assertEquals("value2", options.get("key2"));
Assert.assertEquals("value3", options.get("key3"));
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class AuthenticationManagerTest method testCustomJAASLoginModule.
@Test
public void testCustomJAASLoginModule() throws Exception {
Properties props = TestEngine.getTestProperties();
// Supply a custom LoginModule class
props.put("jspwiki.loginModule.class", "org.apache.wiki.auth.login.CookieAssertionLoginModule");
// Init the engine and verify that we initialized with a custom auth
// login module
WikiEngine engine = new TestEngine(props);
AuthenticationManager authMgr = engine.getAuthenticationManager();
Assert.assertEquals(CookieAssertionLoginModule.class, authMgr.m_loginModuleClass);
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class GroupTest method setUp.
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
WikiEngine engine = new TestEngine(props);
m_wiki = engine.getApplicationName();
m_group = new Group("TestGroup", m_wiki);
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class MetaWeblogHandler method newPost.
/**
* Adds a new post to the blog.
*
* @param blogid The id of the blog.
* @param username The username to use
* @param password The password
* @param content As per Metaweblogapi contract
* @param publish This parameter is ignored for JSPWiki.
* @return Returns an empty string
* @throws XmlRpcException If something goes wrong
*/
public String newPost(String blogid, String username, String password, Hashtable content, boolean publish) throws XmlRpcException {
log.info("metaWeblog.newPost() called");
WikiEngine engine = m_context.getEngine();
WikiPage page = engine.getPage(blogid);
checkPermissions(page, username, password, "createPages");
try {
WeblogEntryPlugin plugin = new WeblogEntryPlugin();
String pageName = plugin.getNewEntryPage(engine, blogid);
WikiPage entryPage = new WikiPage(engine, pageName);
entryPage.setAuthor(username);
WikiContext context = new WikiContext(engine, entryPage);
StringBuilder text = new StringBuilder();
text.append("!" + content.get("title"));
text.append("\n\n");
text.append(content.get("description"));
log.debug("Writing entry: " + text);
engine.saveText(context, text.toString());
} catch (Exception e) {
log.error("Failed to create weblog entry", e);
throw new XmlRpcException(0, "Failed to create weblog entry: " + e.getMessage());
}
// FIXME:
return "";
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class UserProfileTest method setUp.
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
PropertyConfigurator.configure(props);
WikiEngine engine = new TestEngine(props);
m_db = engine.getUserManager().getUserDatabase();
}
Aggregations