From 632acc1504582b0cba5b6dd5ffb062a95b5c6fcf Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 19 Jul 2016 19:55:24 +0800 Subject: [PATCH] Initial Commit --- build.xml | 126 ++++++++++++++++++ lib/.gitkeep | 0 plugin.xml | 25 ++++ .../auth/cas/CasAuthenticatePlateAnchor.java | 21 +++ .../auth/cas/bridge/CasAuthenticatePlate.java | 25 ++++ .../cas/core/CasAuthenticateObjectType.java | 69 ++++++++++ .../plugin/auth/cas/core/CasConstants.java | 9 ++ .../solution/plugin/auth/cas/web/auth.cas.js | 27 ++++ 8 files changed, 302 insertions(+) create mode 100644 build.xml create mode 100644 lib/.gitkeep create mode 100644 plugin.xml create mode 100644 src/com/fr/solution/plugin/auth/cas/CasAuthenticatePlateAnchor.java create mode 100644 src/com/fr/solution/plugin/auth/cas/bridge/CasAuthenticatePlate.java create mode 100644 src/com/fr/solution/plugin/auth/cas/core/CasAuthenticateObjectType.java create mode 100644 src/com/fr/solution/plugin/auth/cas/core/CasConstants.java create mode 100644 src/com/fr/solution/plugin/auth/cas/web/auth.cas.js diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..4439690 --- /dev/null +++ b/build.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/.gitkeep b/lib/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..05a5780 --- /dev/null +++ b/plugin.xml @@ -0,0 +1,25 @@ + + com.fr.solution.plugin.auth.cas + + yes + 1.0 + 8.0 + 2016-06-20 + solution.richie + + + ]]> + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/com/fr/solution/plugin/auth/cas/CasAuthenticatePlateAnchor.java b/src/com/fr/solution/plugin/auth/cas/CasAuthenticatePlateAnchor.java new file mode 100644 index 0000000..e9b25d6 --- /dev/null +++ b/src/com/fr/solution/plugin/auth/cas/CasAuthenticatePlateAnchor.java @@ -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 classForPlate() { + return CasAuthenticatePlate.class; + } + + @Override + public String mark() { + return CasConstants.MARK_TYPE; + } +} diff --git a/src/com/fr/solution/plugin/auth/cas/bridge/CasAuthenticatePlate.java b/src/com/fr/solution/plugin/auth/cas/bridge/CasAuthenticatePlate.java new file mode 100644 index 0000000..bb0bf7e --- /dev/null +++ b/src/com/fr/solution/plugin/auth/cas/bridge/CasAuthenticatePlate.java @@ -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" + }; + } +} diff --git a/src/com/fr/solution/plugin/auth/cas/core/CasAuthenticateObjectType.java b/src/com/fr/solution/plugin/auth/cas/core/CasAuthenticateObjectType.java new file mode 100644 index 0000000..271af1d --- /dev/null +++ b/src/com/fr/solution/plugin/auth/cas/core/CasAuthenticateObjectType.java @@ -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(); + } +} diff --git a/src/com/fr/solution/plugin/auth/cas/core/CasConstants.java b/src/com/fr/solution/plugin/auth/cas/core/CasConstants.java new file mode 100644 index 0000000..e609ef0 --- /dev/null +++ b/src/com/fr/solution/plugin/auth/cas/core/CasConstants.java @@ -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"; +} diff --git a/src/com/fr/solution/plugin/auth/cas/web/auth.cas.js b/src/com/fr/solution/plugin/auth/cas/web/auth.cas.js new file mode 100644 index 0000000..b68615c --- /dev/null +++ b/src/com/fr/solution/plugin/auth/cas/web/auth.cas.js @@ -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; \ No newline at end of file