Search in sources :

Example 16 with RaAccount

use of com.itrus.portal.db.RaAccount in project portal by ixinportal.

the class MobileApplyConfigController method creatForm.

// 返回新建页面
@RequestMapping(params = "form", produces = "text/html")
public String creatForm(Model uiModel) {
    // 得到所有应用
    List<ApplicationInfo> applicationInfos = applicationInfoService.selectByExample(new ApplicationInfoExample());
    uiModel.addAttribute("applicationInfos", applicationInfos);
    Iterator<ApplicationInfo> iterator = applicationInfos.iterator();
    while (iterator.hasNext()) {
        ApplicationInfo mobileApply = iterator.next();
        MobileApplyConfigManage appserviceChargings = mobileApplyConfigService.selectByappId(mobileApply.getAppId());
        if (null != appserviceChargings) {
            iterator.remove();
        }
    }
    uiModel.addAttribute("applicationInfos", applicationInfos);
    // 得到所有RA 服务信息
    List<RaAccount> accounts = raAccountService.getRaAccounts();
    uiModel.addAttribute("accounts", accounts);
    return "applyconfig/create";
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) RaAccount(com.itrus.portal.db.RaAccount) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) MobileApplyConfigManage(com.itrus.portal.db.MobileApplyConfigManage) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with RaAccount

use of com.itrus.portal.db.RaAccount in project portal by ixinportal.

the class MobileWebSocketLogService method execute.

/**
 *	 service:certApply 申请证书移动端需要传过来的参数
 *	 1.设备信息 device
 *	 equipmentCategory	String	设备型号
 *	 appId	Long	应用的名称
 *	 operatingSystem	String	操作系统
 *	 userId	Long	和用户关联的字段
 *	 createTime	date	创建时间
 *	 updateTime	date	修改时间
 *	 deviceSerialNumber	string	设备序列号 唯一标识
 *	 2.用户信息 即 注册信息 user
 *	 name	String	用户姓名
 *	 phone	String	手机号
 *	 idNumber	String	身份证号
 *	 appId	Long	和应用关联的字段
 *	 email	String	电子邮件
 *	 registrationTime	 date	注册时间
 *	 createTime	date	创建时间
 *	 updateTime	 date	修改时间
 *	 userCode	String	用户编码
 *
 *	 最后保存 用户信息 设备信息 证书信息 // TODO: 2017/12/8
 * @param content
 * @return
 */
@Override
public Map<String, Object> execute(String content) {
    Map<String, Object> result = new HashMap<String, Object>(3);
    result.put("status", 0);
    try {
        JSONObject param = JSON.parseObject(content);
        String appId = param.getString("appId");
        ApplicationInfo applicationInfo = applicationInfoService.getApplicationInfo(appId);
        MobileApplyConfigManage mobileApplyConfig = mobileApplyConfigService.selectByappId(appId);
        CertUtlis certutil = new CertUtlis();
        JSONObject jsonUser = param.getJSONObject("user");
        // 根据证书信息项设置 rauserinfo对象 // TODO: 2017/12/26
        UserInfo rauserinfo = new UserInfo();
        rauserinfo.setUserName(jsonUser.getString("name"));
        rauserinfo.setUserEmail(jsonUser.getString("email"));
        rauserinfo.setUserAdditionalField1(applicationInfo.getName());
        rauserinfo.setUserAdditionalField4(jsonUser.getString("userCode"));
        Integer certValidity = 7;
        if (mobileApplyConfig.getCertificatedeadline() == null || "0".equals(mobileApplyConfig.getCertificatedeadline())) {
            certValidity = null;
        } else if (1 == mobileApplyConfig.getCertificatedeadline()) {
            certValidity = 365 * 1 + 1;
        } else if (2 == mobileApplyConfig.getCertificatedeadline()) {
            certValidity = 365 * 2 + 1;
        } else if (3 == mobileApplyConfig.getCertificatedeadline()) {
            certValidity = 365 * 3 + 1;
        } else if (4 == mobileApplyConfig.getCertificatedeadline()) {
            certValidity = 365 * 5 + 2;
        } else if (5 == mobileApplyConfig.getCertificatedeadline()) {
            certValidity = 365 * 10 + 2;
        }
        RaAccount ra = raAccountService.getRaAccount(mobileApplyConfig.getRaaccountId());
        if (ra.getAaPassword() != null) {
            ra.setAaPassword(AESencrp.decrypt(ra.getAaPassword(), dbEncKey));
        }
        CertInfo racertinfo = certutil.enrollCertByWS(param.getString("csr"), ra, rauserinfo, certValidity);
        result.put("status", 1);
        result.put("message", "制作证书成功");
    } catch (Exception e) {
        result.put("message", e.toString());
    }
    return result;
}
Also used : CertInfo(cn.topca.tca.ra.service.CertInfo) HashMap(java.util.HashMap) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) UserInfo(cn.topca.tca.ra.service.UserInfo) MobileApplyConfigManage(com.itrus.portal.db.MobileApplyConfigManage) CertUtlis(com.itrus.portal.utils.CertUtlis) JSONObject(com.alibaba.fastjson.JSONObject) RaAccount(com.itrus.portal.db.RaAccount) JSONObject(com.alibaba.fastjson.JSONObject)

Example 18 with RaAccount

use of com.itrus.portal.db.RaAccount in project portal by ixinportal.

the class RaAccountServiceImpl method getRaByAccountHash.

public RaAccount getRaByAccountHash(String accountHash) {
    RaAccountExample example = new RaAccountExample();
    RaAccountExample.Criteria criteria = example.or();
    criteria.andAccountHashEqualTo(accountHash);
    example.setLimit(1);
    RaAccount raAccount = sqlSession.selectOne("com.itrus.portal.db.RaAccountMapper.selectByExample", example);
    return raAccount;
}
Also used : RaAccount(com.itrus.portal.db.RaAccount) RaAccountExample(com.itrus.portal.db.RaAccountExample)

Example 19 with RaAccount

use of com.itrus.portal.db.RaAccount in project portal by ixinportal.

the class CertUtilsTest method testEnrollCert.

@Test
public void testEnrollCert() throws MalformedURLException, RaServiceUnavailable_Exception {
    RaAccount raAccount = sqlsession.selectOne("com.itrus.portal.db.RaAccountMapper.selectByPrimaryKey", 1);
    InputStream in = EnrolCertTest.class.getResourceAsStream("/com/itrus/portal/utils/test/csr.pem");
    String csr = EnrolCertTest.stream2String(in, "UTF-8");
    CertUtlis cu = new CertUtlis();
// CertInfo certInfo = cu.enrollCertByWS(csr, raAccount, null);
// System.out.println(certInfo.getCertIssuerDn());
}
Also used : InputStream(java.io.InputStream) RaAccount(com.itrus.portal.db.RaAccount) CertUtlis(com.itrus.portal.utils.CertUtlis) Test(org.junit.Test)

Aggregations

RaAccount (com.itrus.portal.db.RaAccount)19 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 CertInfo (cn.topca.tca.ra.service.CertInfo)8 JSONObject (com.alibaba.fastjson.JSONObject)6 Bill (com.itrus.portal.db.Bill)6 DigitalCert (com.itrus.portal.db.DigitalCert)6 Product (com.itrus.portal.db.Product)6 IOException (java.io.IOException)5 Date (java.util.Date)5 HashMap (java.util.HashMap)5 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)4 CertBuf (com.itrus.portal.db.CertBuf)4 Enterprise (com.itrus.portal.db.Enterprise)4 UserCert (com.itrus.portal.db.UserCert)4 UserInfo (com.itrus.portal.db.UserInfo)4 ApplicationInfoExample (com.itrus.portal.db.ApplicationInfoExample)3 MobileApplyConfigManage (com.itrus.portal.db.MobileApplyConfigManage)3 CertUtlis (com.itrus.portal.utils.CertUtlis)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 RaServiceUnavailable_Exception (cn.topca.tca.ra.service.RaServiceUnavailable_Exception)2