Trying to extend the login action
o.wagner Jul 21, 2015 12:31 AMHi all,
After setting up (successfully ) a local Jive instance, I try to develop a plugin for Jive sbs 8. I'm very new to Jive and some accompanied techniques. After reading tutorial after tutorial I've reached a point from which I do not get ahead. I have to add some logic to the login action / extend the rememberMeEnabled()-Method.
Here are some documents, I've read for now and tried to use: Override struts login action in Jive 6, Override login action in jive 7, Core Help, Building Plugins, A Straight and To-The-Point 'Hello World' Plugin for Jive 5.0Building Plugins and some other.
For now, I have a structure like this:
MyCustomLoginPlugin.java:
package xxx.yyy; //imports public class MyCustomLoginPlugin implements Plugin { private static final Logger log = LogManager.getLogger(LoginAction.class); @Override public void initPlugin() { log.info("Starting the MyCustomLoginPlugin..."); } @Override public void destroy() { log.info("Stopping the MyCustomLoginPlugin..."); } }
MyCustomLoginAction.java:
package xxx.yyy; //imports public class MyCustomLoginAction extends LoginAction { private static final long serialVersionUID = -6477635117310245921L; private static final Logger log = LogManager.getLogger(LoginActin.class); @Override public boolean isRememberMeEnabled() { //logging etc. //logic with returns... }
Plugin.xml:
<plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.jivesoftware.com/schemas/clearspace/2_5/plugin.xsd"> <name>MyCustomLogin</name> <description>MyCustomLogin</description> <author>My Name</author> <version>1.0.0</version> <minServerVersion>8.0.0.0</minServerVersion> <maxServerVersion>8.0.0.0</maxServerVersion> <!-- you will want to change your class name here! --> <class>xxx.yyy.MyCustomLoginPlugin</class> <!-- <authorURL> <pluginURL> <databaseKey> <databaseVersion> <components> <css> <soy> <javascript> <widget> <macro> <urlmapping> <sitemesh> --> </plugin>
Struts.xml:
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="MyCustomLogin-actions" namespace="/" extends="community-actions-include"> <action name="login" class="xxx.yyy.MyCustomLoginAction"> <result name="input">/template/global/login.ftl</result> <result name="unauthenticated">/template/global/login.ftl</result> <result name="unauthorized">/template/global/unauth.ftl</result> <result name="create-profile" type="redirect">create-account.jspa?username=${username} </result> </action> </package> </struts>
Since my knowledge about spring is very limited - what do I have to add to the spring.xml? I've tried some things but nothing happend. In the server log there is a entry for the "Starting the MyCustomLoginPlugin" from the MyCustomLoginPlugin.java, but nothing more. I'm pretty sure that I am missing some relevant points..
And is the content of my project correct for now or am I on a completely wrong way?