richie
8 years ago
commit
632acc1504
8 changed files with 302 additions and 0 deletions
@ -0,0 +1,126 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||||
|
<project basedir="." default="jar" name="plugin"> |
||||||
|
<!-- JDK路径,根据自己机器上实际位置修改--> |
||||||
|
<property name="jdk.home" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home"/> |
||||||
|
|
||||||
|
<property name="libs" value="${basedir}/lib"/> |
||||||
|
<property name="publicLibs" value=""/> |
||||||
|
<property name="reportLibs" value="${basedir}/lib/report"/> |
||||||
|
<property name="destLoc" value="."/> |
||||||
|
<property name="classes" value="classes"/> |
||||||
|
<xmlproperty file="${basedir}/plugin.xml"/> |
||||||
|
<property name="current-version" value="${plugin.version}"/> |
||||||
|
|
||||||
|
<!-- 插件版本--> |
||||||
|
<property name="plugin-version" value="${current-version}"/> |
||||||
|
<!-- 插件名字--> |
||||||
|
<property name="plugin-name" value="cas-auth"/> |
||||||
|
<property name="plugin-jar" value="fr-plugin-${plugin-name}-${plugin-version}.jar"/> |
||||||
|
|
||||||
|
<target name="prepare"> |
||||||
|
<delete dir="${classes}"/> |
||||||
|
<delete dir="fr-plugin-${plugin-name}-${plugin-version}"/> |
||||||
|
<xmlproperty file="${basedir}/plugin.xml"/> |
||||||
|
<delete dir="${destLoc}/${plugin.name}"/> |
||||||
|
</target> |
||||||
|
<path id="compile.classpath"> |
||||||
|
<fileset dir="${libs}"> |
||||||
|
<include name="**/*.jar"/> |
||||||
|
</fileset> |
||||||
|
<fileset dir="${publicLibs}"> |
||||||
|
<include name="**/*.jar"/> |
||||||
|
</fileset> |
||||||
|
<fileset dir="${reportLibs}"> |
||||||
|
<include name="**/*.jar"/> |
||||||
|
</fileset> |
||||||
|
</path> |
||||||
|
<patternset id="resources4Jar"> |
||||||
|
<exclude name="**/.settings/**"/> |
||||||
|
<exclude name=".classpath"/> |
||||||
|
<exclude name=".project"/> |
||||||
|
|
||||||
|
<exclude name="**/*.java"/> |
||||||
|
<exclude name="**/*.db"/> |
||||||
|
<exclude name="**/*.g"/> |
||||||
|
<exclude name="**/package.html"/> |
||||||
|
</patternset> |
||||||
|
<target name="copy_resources"> |
||||||
|
<echo message="从${resources_from}拷贝图片,JS,CSS等资源文件"/> |
||||||
|
<delete dir="tmp"/> |
||||||
|
<copy todir="tmp"> |
||||||
|
<fileset dir="${resources_from}\src"> |
||||||
|
<patternset refid="resources4Jar"/> |
||||||
|
</fileset> |
||||||
|
</copy> |
||||||
|
<copy todir="${classes}"> |
||||||
|
<fileset dir="tmp"/> |
||||||
|
</copy> |
||||||
|
<delete dir="tmp"/> |
||||||
|
</target> |
||||||
|
<target name="compile_javas"> |
||||||
|
<echo message="编译${compile_files}下的Java文件"/> |
||||||
|
<javac destdir="${classes}" debug="false" optimize="on" source="${source_jdk_version}" |
||||||
|
target="${target_jdk_version}" |
||||||
|
fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}" |
||||||
|
executable="${compile_jdk_version}/bin/javac"> |
||||||
|
<src path="${basedir}/src"/> |
||||||
|
<exclude name="**/.svn/**"/> |
||||||
|
<compilerarg line="-encoding UTF8 "/> |
||||||
|
<classpath refid="compile.classpath"/> |
||||||
|
</javac> |
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="jar_classes"> |
||||||
|
<echo message="打Jar包:${jar_name}"/> |
||||||
|
<delete file="${basedir}/${jar_name}"/> |
||||||
|
<jar jarfile="${basedir}/${jar_name}"> |
||||||
|
<fileset dir="${classes}"> |
||||||
|
</fileset> |
||||||
|
</jar> |
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="super_jar" depends="prepare"> |
||||||
|
<antcall target="copy_resources"> |
||||||
|
<param name="resources_from" value="${basedir}"/> |
||||||
|
</antcall> |
||||||
|
<antcall target="compile_javas"> |
||||||
|
<param name="source_jdk_version" value="1.6"/> |
||||||
|
<param name="target_jdk_version" value="1.6"/> |
||||||
|
<param name="compile_jdk_version" value="${jdk.home}"/> |
||||||
|
<param name="compile_files" value="${basedir}/src"/> |
||||||
|
</antcall> |
||||||
|
<echo message="compile plugin success!"/> |
||||||
|
|
||||||
|
<antcall target="jar_classes"> |
||||||
|
<param name="jar_name" value="${plugin-jar}"/> |
||||||
|
</antcall> |
||||||
|
<delete dir="${classes}"/> |
||||||
|
|
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="jar" depends="super_jar"> |
||||||
|
<antcall target="zip"/> |
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="zip"> |
||||||
|
<property name="plugin-folder" value="fr-plugin-${plugin-name}-${plugin-version}"/> |
||||||
|
<echo message="----------zip files----------"/> |
||||||
|
<mkdir dir="${plugin-folder}"/> |
||||||
|
<copy todir="${plugin-folder}"> |
||||||
|
<fileset dir="."> |
||||||
|
<include name="${plugin-jar}"/> |
||||||
|
<include name="plugin.xml"/> |
||||||
|
</fileset> |
||||||
|
<fileset dir="${libs}"> |
||||||
|
<include name="*.jar"/> |
||||||
|
<include name="*.dll"/> |
||||||
|
</fileset> |
||||||
|
</copy> |
||||||
|
<zip destfile="${basedir}/${plugin-folder}.zip" basedir="."> |
||||||
|
<include name="${plugin-folder}/*.jar"/> |
||||||
|
<include name="${plugin-folder}/*.dll"/> |
||||||
|
<include name="${plugin-folder}/plugin.xml"/> |
||||||
|
</zip> |
||||||
|
<move file="${plugin-folder}.zip" todir="${destLoc}/${plugin.name}"/> |
||||||
|
</target> |
||||||
|
</project> |
@ -0,0 +1,25 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin> |
||||||
|
<id>com.fr.solution.plugin.auth.cas</id> |
||||||
|
<name><![CDATA[平台使用Cas认证]]></name> |
||||||
|
<active>yes</active> |
||||||
|
<version>1.0</version> |
||||||
|
<env-version>8.0</env-version> |
||||||
|
<jartime>2016-06-20</jartime> |
||||||
|
<vendor email="solution@finereport.com">solution.richie</vendor> |
||||||
|
<description><![CDATA[使用cas认证]]></description> |
||||||
|
<change-notes><![CDATA[ |
||||||
|
[2016-06-20]初始化<br/> |
||||||
|
]]></change-notes> |
||||||
|
<extra-core> |
||||||
|
|
||||||
|
</extra-core> |
||||||
|
<extra-report> |
||||||
|
|
||||||
|
</extra-report> |
||||||
|
<extra-platform> |
||||||
|
<PlateProvider class="com.fr.solution.plugin.auth.cas.CasAuthenticatePlateAnchor"/> |
||||||
|
</extra-platform> |
||||||
|
<extra-designer> |
||||||
|
|
||||||
|
</extra-designer> |
||||||
|
</plugin> |
@ -0,0 +1,21 @@ |
|||||||
|
package com.fr.solution.plugin.auth.cas; |
||||||
|
|
||||||
|
import com.fr.fs.FSPlate; |
||||||
|
import com.fr.fs.fun.impl.AbstractPlateProvider; |
||||||
|
import com.fr.solution.plugin.auth.cas.bridge.CasAuthenticatePlate; |
||||||
|
import com.fr.solution.plugin.auth.cas.core.CasConstants; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by richie on 16/7/19. |
||||||
|
*/ |
||||||
|
public class CasAuthenticatePlateAnchor extends AbstractPlateProvider { |
||||||
|
@Override |
||||||
|
public Class<? extends FSPlate> classForPlate() { |
||||||
|
return CasAuthenticatePlate.class; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String mark() { |
||||||
|
return CasConstants.MARK_TYPE; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package com.fr.solution.plugin.auth.cas.bridge; |
||||||
|
|
||||||
|
import com.fr.fs.DefaultPlate; |
||||||
|
import com.fr.fs.auth.AuthenticateObjectTypeBuilder; |
||||||
|
import com.fr.solution.plugin.auth.cas.core.CasAuthenticateObjectType; |
||||||
|
import com.fr.solution.plugin.auth.cas.core.CasConstants; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by richie on 16/7/19. |
||||||
|
*/ |
||||||
|
public class CasAuthenticatePlate extends DefaultPlate { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void initData() { |
||||||
|
super.initData(); |
||||||
|
AuthenticateObjectTypeBuilder.register(CasConstants.MARK_TYPE, CasAuthenticateObjectType.class); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String[] getPlateJavaScriptFiles4WebClient() { |
||||||
|
return new String[]{ |
||||||
|
"/com/fr/solution/plugin/auth/cas/web/auth.cas.js" |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
package com.fr.solution.plugin.auth.cas.core; |
||||||
|
|
||||||
|
import com.fr.fs.auth.AuthenticateObjectType; |
||||||
|
import com.fr.privilege.Authentication; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import com.fr.stable.xml.XMLPrintWriter; |
||||||
|
import com.fr.stable.xml.XMLableReader; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by richie on 16/7/19. |
||||||
|
*/ |
||||||
|
public class CasAuthenticateObjectType implements AuthenticateObjectType { |
||||||
|
|
||||||
|
private static final String XML_TAG = "CasAuthenticateObjectType"; |
||||||
|
|
||||||
|
private String casUrl; |
||||||
|
|
||||||
|
public CasAuthenticateObjectType() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean authentication(Authentication authentication) throws Exception { |
||||||
|
// richie:这里补充cas认证信息
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean authenticationWithoutPassword() { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCasUrl() { |
||||||
|
return casUrl; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCasUrl(String casUrl) { |
||||||
|
this.casUrl = casUrl; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String markType() { |
||||||
|
return CasConstants.MARK_TYPE; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Object clone() throws CloneNotSupportedException { |
||||||
|
CasAuthenticateObjectType cloned = (CasAuthenticateObjectType) super.clone(); |
||||||
|
cloned.casUrl = casUrl; |
||||||
|
return cloned; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void readXML(XMLableReader reader) { |
||||||
|
if (reader.isChildNode()) { |
||||||
|
String tagName = reader.getTagName(); |
||||||
|
if (XML_TAG.equals(tagName)) { |
||||||
|
casUrl = reader.getAttrAsString("url", StringUtils.EMPTY); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void writeXML(XMLPrintWriter writer) { |
||||||
|
writer.startTAG(XML_TAG); |
||||||
|
writer.attr("url", casUrl); |
||||||
|
writer.end(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
package com.fr.solution.plugin.auth.cas.core; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by richie on 16/7/19. |
||||||
|
*/ |
||||||
|
public class CasConstants { |
||||||
|
|
||||||
|
public static final String MARK_TYPE = "cas"; |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
/** |
||||||
|
* Created by richie on 16/7/19. |
||||||
|
*/ |
||||||
|
FS.Plugin.AuthenticateTypePool.push({ |
||||||
|
|
||||||
|
defineTypeString: function () { |
||||||
|
return 'cas' |
||||||
|
}, |
||||||
|
defineTitleString: function () { |
||||||
|
return 'Cas认证'; |
||||||
|
}, |
||||||
|
defineRowHeightNumber: function () { |
||||||
|
return 21; |
||||||
|
}, |
||||||
|
defineUI: function () { |
||||||
|
return [{}, {}, {type: 'text', widgetName: 'cas', watermark: 'Cas认证地址'}]; |
||||||
|
}, |
||||||
|
saveDataSync: function (container) { |
||||||
|
return FS.Async.ajax({ |
||||||
|
url: FR.servletURL + '?op=cas&cmd=save', |
||||||
|
data: { |
||||||
|
name : container.getWidgetByName('cas').getValue() |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
debugger; |
Loading…
Reference in new issue