📄 owauthentication.java
字号:
// ----------------------------------------------------------------------------
// $Source: /cvs/vas2006/webpro2/webpro_java/src/com/onewaveinc/portalman/webpro/OWAuthentication.java,v $
// ----------------------------------------------------------------------------
// Copyright (c) 2002 by Onewave Inc.
// ----------------------------------------------------------------------------
// $Id: OWAuthentication.java,v 1.1.1.1 2006/08/01 05:49:33 zhengx Exp $
// ----------------------------------------------------------------------------
// $Log: OWAuthentication.java,v $
// Revision 1.1.1.1 2006/08/01 05:49:33 zhengx
// no message
//
// Revision 1.1 2006/06/02 03:33:15 wuyan
// *** empty log message ***
//
// Revision 1.2 2006/05/17 12:13:42 lufang
// no message
//
// Revision 1.1 2005/12/08 10:36:27 like
// no message
//
// Revision 1.1 2003/07/28 06:29:59 zengc
// no message
//
// Revision 1.11 2003/03/15 06:13:02 guoex
// no message
//
// Revision 1.10 2003/03/07 08:48:05 zengc
// V20
//
//
// ----------------------------------------------------------------------------
package com.onewaveinc.portalman.webpro;
/**
* <p>Title: PortalMAN SDK API Documentation</p>
* <p>Description: OneWave Technologies., Inc. PortalMAN Value-add Management Platform 3rd Software Development Kit</p>
* <p>Copyright: Copyright (c) 2002 </p>
* <p>Company: OneWave Technologies., Inc.</p>
* @author 3rd AAA & ICP Integration Developement Team
* @version 1.5
*/
//import com.onewaveinc.portalman.aaa.AAARequestHandlerIF;
import com.onewaveinc.portalman.webpro.soap.*;
import com.onewaveinc.portalman.aaa.v20.soapentity.*;
import com.onewaveinc.portalman.webpro.security.SecurityMgr;
import com.onewaveinc.portalman.aaa.client.*;
import java.lang.reflect.Field;
import java.util.*;
/**
* 该类是认证信息记录接口<BR>
* ICP通过调用此类的接口向认证中心发送用户认证信息
*/
public class OWAuthentication {
private Vector paras;
/**
* 类构建器
* @param conf SOAP调用参数
* @return
*/
OWAuthentication(Vector conf){
this.paras = conf;
}
/**
* 用户在ICP订购服务的接口
* @param request com.onewaveinc.portalman.webpro.entity.OWSubscriptionFromICP
* @return com.onewaveinc.portalman.webpro.entity.OWSubscriptionResult
* @throws Exception
*/
public com.onewaveinc.portalman.webpro.entity.OWSubscriptionResult
OWAddSubscriptionFromICP(com.onewaveinc.portalman.webpro.entity.OWSubscriptionFromICP request) throws Exception{
return subtoicp("OWAddSubscriptionFromICP",request);
}
/**
* 用户在ICP订购服务的接口
* @param request com.onewaveinc.portalman.webpro.entity.OWSubscriptionFromICP
* @return com.onewaveinc.portalman.webpro.entity.OWSubscriptionResult
* @throws Exception
*/
public com.onewaveinc.portalman.webpro.entity.OWSubscriptionResult
OWRemoveSubscriptionFromICP(com.onewaveinc.portalman.webpro.entity.OWSubscriptionFromICP request) throws Exception{
return subtoicp("OWRemoveSubscriptionFromICP",request);
}
private com.onewaveinc.portalman.webpro.entity.OWSubscriptionResult
subtoicp(String invokeMethodName,com.onewaveinc.portalman.webpro.entity.OWSubscriptionFromICP request) throws Exception{
SOAPConfig config = new SOAPConfig(paras);
com.onewaveinc.portalman.webpro.entity.OWSubscriptionResult returnobj = null;
boolean loopFlag = config.getNextConfig();
while(loopFlag){
try {
WebProManager.debug("Invoke OWAuthentication." + invokeMethodName + "(OWAuthenticateRequest request) ......");
//WebProManager.debug("Parameter entity object: \n" + request);
String icpCode =WebProManager.mICPCode;
String icpKey =WebProManager.mICPKey;
OWSubscriptionFromICP soap = (OWSubscriptionFromICP)
SOAPConveror.getEncodeEntity(request,"com.onewaveinc.portalman.aaa.v20.soapentity.OWSubscriptionFromICP");
soap.setIcpCode(icpCode);
soap.setVersionNO(WebProManager.mVersion);
WebProManager.debug("SOAP object to be send befor encypte: \n" + soap);
WebProManager.log("SOAP object to be send befor encypte: \n" + soap);
//encrypte
SecurityMgr.getEncyptedObjUseICPKey(soap,null,icpKey);
//WebProManager.debug("SOAP object to be send , after encypte: \n" + soap);
String oldIcpCode = soap.getIcpCode();
String soapRouterURL = config.getRouterURL();
String soapTargetObjectURI = config.getUrn();
WebProManager.debug("Connect to SOAP Server: RouterURL=" + soapRouterURL + " , TargetObjectURI=" + soapTargetObjectURI);
AAARequestHandlerIF service = new AAARequestHandlerIF_Impl(soapRouterURL);
AAARequestHandlerIFPort port = service.getAAARequestHandlerIFPort();
OWSubscriptionResult result = null;
String requeststr = SOAPEntityConvertor.Object2String(soap);
String resultstr = null;
if(invokeMethodName.equalsIgnoreCase("OWAddSubscriptionFromICP")){
resultstr = port.oWAddSubscriptionFromICP(requeststr);
}else if(invokeMethodName.equalsIgnoreCase("OWRemoveSubscriptionFromICP")){
resultstr = port.oWRemoveSubscriptionFromICP(requeststr);
}else{
throw new Exception("Can't find method in SOAP server:"+ invokeMethodName);
}
// Class[] interfaces = new Class[] {AAARequestHandlerIF.class};
// AAARequestHandlerIF aaa = (AAARequestHandlerIF)(SOAPProxy.newInstance(soapRouterURL, soapTargetObjectURI, interfaces));
// OWSubscriptionResult result = null;
// String requeststr = SOAPEntityConvertor.Object2String(soap);
// String resultstr = null;
// if(invokeMethodName.equalsIgnoreCase("OWAddSubscriptionFromICP")){
// resultstr = aaa.OWAddSubscriptionFromICP(requeststr);
// }else if(invokeMethodName.equalsIgnoreCase("OWRemoveSubscriptionFromICP")){
// resultstr = aaa.OWRemoveSubscriptionFromICP(requeststr);
// }else{
// throw new Exception("Can't find method in SOAP server:"+ invokeMethodName);
// }
result = (OWSubscriptionResult) SOAPEntityConvertor.String2Object(resultstr,OWSubscriptionResult.class);
//WebProManager.debug("SOAP object get from server, befor decypte: \n" + result);
//decrypte
SecurityMgr.getDecyptedObjUseICPKey(result,icpKey,oldIcpCode);
WebProManager.debug("SOAP object get from server, after decypte: \n" + result);
WebProManager.log("SOAP object get from server, after decypte: \n" + result);
returnobj = (com.onewaveinc.portalman.webpro.entity.OWSubscriptionResult)
SOAPConveror.getDecodeEntity(result,"com.onewaveinc.portalman.webpro.entity.OWSubscriptionResult");
WebProManager.debug("Enity object return: \n" + returnobj);
loopFlag = false;
}catch (Exception ex) {
if(loopFlag = config.getNextConfig()){
ex.printStackTrace();
WebProManager.log("Find Exception in Invoke OWAuthentication." + invokeMethodName + "(OWAuthenticateRequest request)");
ex.printStackTrace(WebProManager.getLog());
WebProManager.getLog().flush();
System.out.println("Find Exception in Invoke OWAuthentication." + invokeMethodName + "(OWAuthenticateRequest request), try next server");
}else{
WebProManager.log("Find Exception in Invoke OWAuthentication." + invokeMethodName + "(OWAuthenticateRequest request)");
ex.printStackTrace(WebProManager.getLog());
WebProManager.getLog().flush();
throw ex;
}
}
}
WebProManager.closelog();
return returnobj;
}
/**
* authorizeOnLine
* @param request com.onewaveinc.portalman.webpro.entity.OWAuthorizeRequest
* @return com.onewaveinc.portalman.webpro.entity.OWAuthorizeResult
* @throws Exception
*/
// public com.onewaveinc.portalman.webpro.entity.OWAuthorizeResult
// OWAuthorizeOnLine(com.onewaveinc.portalman.webpro.entity.OWAuthorizeRequest request) throws Exception{
// return authrizeall("OWAuthorizeOnLine",request);
// }
/**
* authorizeOffLine
* @param request com.onewaveinc.portalman.webpro.entity.OWAuthorizeRequest
* @return com.onewaveinc.portalman.webpro.entity.OWAuthorizeResult
* @throws Exception
*/
public com.onewaveinc.portalman.webpro.entity.OWAuthorizeResult
OWAuthorizeOffLine(com.onewaveinc.portalman.webpro.entity.OWAuthorizeRequest request) throws Exception{
return authrizeall("OWAuthorizeOffLine",request);
}
/**
* authorizeResume
* @param request com.onewaveinc.portalman.webpro.entity.OWAuthorizeRequest
* @return com.onewaveinc.portalman.webpro.entity.OWAuthorizeResult
* @throws Exception
*/
// public com.onewaveinc.portalman.webpro.entity.OWAuthorizeResult
// OWAuthorizeResume(com.onewaveinc.portalman.webpro.entity.OWAuthorizeRequest request) throws Exception{
// return authrizeall("OWAuthorizeResume",request);
// }
/**
* authorizeCancel
* @param request com.onewaveinc.portalman.webpro.entity.OWAuthorizeRequest
* @return com.onewaveinc.portalman.webpro.entity.OWAuthorizeResult
* @throws Exception
*/
// public com.onewaveinc.portalman.webpro.entity.OWAuthorizeResult
// OWAuthorizeCancel(com.onewaveinc.portalman.webpro.entity.OWAuthorizeRequest request) throws Exception{
// return authrizeall("OWAuthorizeCancel",request);
// }
private com.onewaveinc.portalman.webpro.entity.OWAuthorizeResult
authrizeall(String invokeMethodName,com.onewaveinc.portalman.webpro.entity.OWAuthorizeRequest request) throws Exception{
SOAPConfig config = new SOAPConfig(paras);
com.onewaveinc.portalman.webpro.entity.OWAuthorizeResult returnobj = null;
boolean loopFlag = config.getNextConfig();
while(loopFlag){
try {
WebProManager.debug("Invoke OWAuthentication." + invokeMethodName + "(OWAuthenticateRequest request) ......");
//WebProManager.debug("Parameter entity object: \n" + request);
String icpCode =WebProManager.mICPCode;
String icpKey =WebProManager.mICPKey;
OWAuthorizeRequest soap = (OWAuthorizeRequest)
SOAPConveror.getEncodeEntity(request,"com.onewaveinc.portalman.aaa.v20.soapentity.OWAuthorizeRequest");
soap.setIcpCode(icpCode);
soap.setVersionNO(WebProManager.mVersion);
soap.setIcpMode(WebProManager.mICPMode);
WebProManager.debug("SOAP object to be send befor encypte: \n" + soap);
WebProManager.log("SOAP object to be send befor encypte: \n" + soap);
//encrypte
SecurityMgr.getEncyptedObjUseICPKey(soap,null,icpKey);
//WebProManager.debug("SOAP object to be send , after encypte: \n" + soap);
String oldIcpCode = soap.getIcpCode();
String soapRouterURL = config.getRouterURL();
String soapTargetObjectURI = config.getUrn();
WebProManager.debug("Connect to SOAP Server: RouterURL=" + soapRouterURL + " , TargetObjectURI=" + soapTargetObjectURI);
AAARequestHandlerIF service = new AAARequestHandlerIF_Impl(soapRouterURL);
AAARequestHandlerIFPort port = service.getAAARequestHandlerIFPort();
OWAuthorizeResult result = null;
String requeststr = SOAPEntityConvertor.Object2String(soap);
String resultstr = null;
if(invokeMethodName.equalsIgnoreCase("OWAuthorizeOnLine")){
resultstr = port.oWAuthorizeOnLine(requeststr);
}else if(invokeMethodName.equalsIgnoreCase("OWAuthorizeOffLine")){
resultstr = port.oWAuthorizeOffLine(requeststr);
}else if(invokeMethodName.equalsIgnoreCase("OWAuthorizeResume")){
resultstr = port.oWAuthorizeResume(requeststr);
}else if(invokeMethodName.equalsIgnoreCase("OWAuthorizeCancel")){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -