Search in sources :

Example 11 with CoreConfig

use of app.hongs.CoreConfig in project HongsCORE by ihongs.

the class QQAction method inWap.

/**
 * QQ WAP 登录回调
 * @param helper
 * @throws HongsException
 */
@Action("wap/create")
public void inWap(ActionHelper helper) throws HongsException {
    CoreConfig cc = CoreConfig.getInstance("oauth2");
    String appId = cc.getProperty("oauth2.qq.wap.app.id");
    String appSk = cc.getProperty("oauth2.qq.wap.app.key");
    String rurl = cc.getProperty("oauth2.qq.wap.bak.url");
    String code = helper.getParameter("code");
    if (appId == null || appSk == null) {
        helper.error500("Not support this mode");
    }
    Map info = getUserInfo(code, appId, appSk, rurl, true);
    String opnId = (String) info.get("opnid");
    String name = (String) info.get("name");
    String head = (String) info.get("head");
    AuthKit.openSign(helper, "wx", appId, opnId, name, head, System.currentTimeMillis());
    ConnKit.redirect(helper);
}
Also used : CoreConfig(app.hongs.CoreConfig) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action)

Example 12 with CoreConfig

use of app.hongs.CoreConfig in project HongsCORE by ihongs.

the class QQAction method inWeb.

/**
 * QQ Web 登录回调
 * @param helper
 * @throws HongsException
 */
@Action("web/create")
public void inWeb(ActionHelper helper) throws HongsException {
    CoreConfig cc = CoreConfig.getInstance("oauth2");
    String appId = cc.getProperty("oauth2.qq.web.app.id");
    String appSk = cc.getProperty("oauth2.qq.web.app.key");
    String rurl = cc.getProperty("oauth2.qq.wap.bak.url");
    String code = helper.getParameter("code");
    if (appId == null || appSk == null) {
        helper.error500("Not support this mode");
    }
    Map info = getUserInfo(code, appId, appSk, rurl, false);
    String opnId = (String) info.get("opnid");
    String name = (String) info.get("name");
    String head = (String) info.get("head");
    AuthKit.openSign(helper, "wx", appId, opnId, name, head, System.currentTimeMillis());
    ConnKit.redirect(helper);
}
Also used : CoreConfig(app.hongs.CoreConfig) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action)

Example 13 with CoreConfig

use of app.hongs.CoreConfig in project HongsCORE by ihongs.

the class WBAction method inWap.

@Action("wap/create")
public void inWap(ActionHelper helper) throws HongsException {
    CoreConfig cc = CoreConfig.getInstance("oauth2");
    String appId = cc.getProperty("oauth2.wb.wap.app.id");
    String appSk = cc.getProperty("oauth2.wb.wap.app.key");
    String rurl = cc.getProperty("oauth2.wb.wap.bak.url");
    String code = helper.getParameter("code");
    if (appId == null || appSk == null) {
        helper.error500("Not support this mode");
    }
    Map info = getUserInfo(code, appId, appSk, rurl);
    String opnId = (String) info.get("opnid");
    String name = (String) info.get("name");
    String head = (String) info.get("head");
    AuthKit.openSign(helper, "wb", appId, opnId, name, head, System.currentTimeMillis());
    ConnKit.redirect(helper);
}
Also used : CoreConfig(app.hongs.CoreConfig) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action)

Example 14 with CoreConfig

use of app.hongs.CoreConfig in project HongsCORE by ihongs.

the class WXAction method inWeb.

/**
 * 微信 Web 登录回调
 * @param helper
 * @throws HongsException
 */
@Action("web/create")
public void inWeb(ActionHelper helper) throws HongsException {
    CoreConfig cc = CoreConfig.getInstance("oauth2");
    String appId = cc.getProperty("oauth2.wx.web.app.id");
    String appSk = cc.getProperty("oauth2.wx.web.app.key");
    String code = helper.getParameter("code");
    if (appId == null || appSk == null) {
        helper.error500("Not support this mode");
    }
    Map info = getUserInfo(code, appId, appSk);
    String opnId = (String) info.get("opnid");
    String name = (String) info.get("name");
    String head = (String) info.get("head");
    AuthKit.openSign(helper, "wx", appId, opnId, name, head, System.currentTimeMillis());
    ConnKit.redirect(helper);
}
Also used : CoreConfig(app.hongs.CoreConfig) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action)

Example 15 with CoreConfig

use of app.hongs.CoreConfig in project HongsCORE by ihongs.

the class WXAction method inWap.

/**
 * 微信 WAP 登录回调
 * @param helper
 * @throws HongsException
 */
@Action("wap/create")
public void inWap(ActionHelper helper) throws HongsException {
    CoreConfig cc = CoreConfig.getInstance("oauth2");
    String appId = cc.getProperty("oauth2.wx.wap.app.id");
    String appSk = cc.getProperty("oauth2.wx.wap.app.key");
    String code = helper.getParameter("code");
    if (appId == null || appSk == null) {
        helper.error500("Not support this mode");
    }
    Map info = getUserInfo(code, appId, appSk);
    String opnId = (String) info.get("opnid");
    String name = (String) info.get("name");
    String head = (String) info.get("head");
    AuthKit.openSign(helper, "wx", appId, opnId, name, head, System.currentTimeMillis());
    ConnKit.redirect(helper);
}
Also used : CoreConfig(app.hongs.CoreConfig) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action)

Aggregations

CoreConfig (app.hongs.CoreConfig)19 Map (java.util.Map)12 HashMap (java.util.HashMap)11 Action (app.hongs.action.anno.Action)7 HongsExpedient (app.hongs.HongsExpedient)3 File (java.io.File)3 IOException (java.io.IOException)3 Core (app.hongs.Core)2 HongsException (app.hongs.HongsException)2 HashSet (java.util.HashSet)2 ServletException (javax.servlet.ServletException)2 Part (javax.servlet.http.Part)2 HongsError (app.hongs.HongsError)1 ActionHelper (app.hongs.action.ActionHelper)1 Cmdlet (app.hongs.cmdlet.anno.Cmdlet)1 Color (java.awt.Color)1 FileWriter (java.io.FileWriter)1 PrintWriter (java.io.PrintWriter)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1