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";
}
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;
}
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;
}
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());
}
Aggregations