Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2467 - in branches/as: conf src/org/perfsonar/commons/auxiliary src/org/perfsonar/commons/auxiliary/components/authn src/org/perfsonar/commons/auxiliary/components/authn/wssec src/org/perfsonar/service/commons/authn src/org/perfsonar/service/testHarness/authService src/org/perfsonar/service/topologyService src/org/perfsonar/service/web

Subject: perfsonar development work

List archive

perfsonar: r2467 - in branches/as: conf src/org/perfsonar/commons/auxiliary src/org/perfsonar/commons/auxiliary/components/authn src/org/perfsonar/commons/auxiliary/components/authn/wssec src/org/perfsonar/service/commons/authn src/org/perfsonar/service/testHarness/authService src/org/perfsonar/service/topologyService src/org/perfsonar/service/web


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2467 - in branches/as: conf src/org/perfsonar/commons/auxiliary src/org/perfsonar/commons/auxiliary/components/authn src/org/perfsonar/commons/auxiliary/components/authn/wssec src/org/perfsonar/service/commons/authn src/org/perfsonar/service/testHarness/authService src/org/perfsonar/service/topologyService src/org/perfsonar/service/web
  • Date: Mon, 11 Jun 2007 06:17:57 -0400

Author: rodriguez
Date: 2007-06-11 06:17:57 -0400 (Mon, 11 Jun 2007)
New Revision: 2467

Added:

branches/as/src/org/perfsonar/commons/auxiliary/components/authn/AuthNComponent.java
branches/as/src/org/perfsonar/commons/auxiliary/components/authn/wssec/

branches/as/src/org/perfsonar/commons/auxiliary/components/authn/wssec/WSSecAuthNComponent.java
Modified:
branches/as/conf/log4j.properties
branches/as/src/org/perfsonar/commons/auxiliary/ComponentNames.java
branches/as/src/org/perfsonar/service/commons/authn/AuthNResponse.java

branches/as/src/org/perfsonar/service/testHarness/authService/AuthNRequestTest.java
branches/as/src/org/perfsonar/service/topologyService/TopServiceEngine.java
branches/as/src/org/perfsonar/service/web/RequestHandler.java
Log:
Updating authN classes. Now, there is an Authentication Component.

Modified: branches/as/conf/log4j.properties
===================================================================
--- branches/as/conf/log4j.properties 2007-06-07 17:34:44 UTC (rev 2466)
+++ branches/as/conf/log4j.properties 2007-06-11 10:17:57 UTC (rev 2467)
@@ -5,7 +5,7 @@


# needs to be adjusted by service deployer
-logDir=/Users/kan/Proyectos/RedIRIS/perfSONAR/tomcat-5.5.20/webapps/perfSONAR-AS/WEB-INF/logs
+logDir=/home/kan/Projects/tomcat/webapps/perfSONAR-AS/WEB-INF/logs


log4j.rootLogger=INFO, rootAppender

Modified: branches/as/src/org/perfsonar/commons/auxiliary/ComponentNames.java
===================================================================
--- branches/as/src/org/perfsonar/commons/auxiliary/ComponentNames.java
2007-06-07 17:34:44 UTC (rev 2466)
+++ branches/as/src/org/perfsonar/commons/auxiliary/ComponentNames.java
2007-06-11 10:17:57 UTC (rev 2467)
@@ -2,19 +2,21 @@

/**
* Interface contains common component names
- *
+ *
* @author Maciej Glowiak
*
*/
public interface ComponentNames {
-
+
public static final String CONFIG = "config";
-
+
public static final String LOGGER = "logger";
-
+
public static final String SCHEDULER = "scheduler";
-
+
public static final String REGISTRATOR = "registrator";

-
+ public static final String AUTHN = "authn";
+
+
} //ComponentNames

Added:
branches/as/src/org/perfsonar/commons/auxiliary/components/authn/AuthNComponent.java

Added:
branches/as/src/org/perfsonar/commons/auxiliary/components/authn/wssec/WSSecAuthNComponent.java

Modified:
branches/as/src/org/perfsonar/service/commons/authn/AuthNResponse.java
===================================================================
--- branches/as/src/org/perfsonar/service/commons/authn/AuthNResponse.java
2007-06-07 17:34:44 UTC (rev 2466)
+++ branches/as/src/org/perfsonar/service/commons/authn/AuthNResponse.java
2007-06-11 10:17:57 UTC (rev 2467)
@@ -5,15 +5,15 @@
import org.ggf.ns.nmwg.base.v2_0.Metadata;

public class AuthNResponse {
- public static final int AUTHORIZED=0;
- public static final int NOT_AUTHORIZED=1;
+ public static final int AUTHENTICATED=0;
+ public static final int NOT_AUTHENTICATED=1;

private int status;
- private String codeResult;
+ private String resultCode;

public AuthNResponse() {
- status=AuthNResponse.NOT_AUTHORIZED;
- codeResult="";
+ status=AuthNResponse.NOT_AUTHENTICATED;
+ resultCode="";
}

public int getStatus() {
@@ -24,12 +24,12 @@
this.status = status;
}

- public String getCodeResult() {
- return codeResult;
+ public String getResultCode() {
+ return resultCode;
}

- public void setCodeResult(String codeResult) {
- this.codeResult = codeResult;
+ public void setResultCode(String codeResult) {
+ this.resultCode = codeResult;
}

public static AuthNResponse getAuthNResponse(Message message) {
@@ -38,12 +38,12 @@
Metadata[] metadatas=message.getMetadataArray();
for (int i=0; i<metadatas.length; i++) {
EventType et=metadatas[i].getEventType();
- res.setCodeResult(et.getEventType());
+ res.setResultCode(et.getEventType());
if (et.getEventType().equals("success.as.authn")) {
- res.setStatus(AuthNResponse.AUTHORIZED);
+ res.setStatus(AuthNResponse.AUTHENTICATED);
}
else {
- res.setStatus(AuthNResponse.NOT_AUTHORIZED);
+
res.setStatus(AuthNResponse.NOT_AUTHENTICATED);
}
}


Modified:
branches/as/src/org/perfsonar/service/testHarness/authService/AuthNRequestTest.java
===================================================================
---
branches/as/src/org/perfsonar/service/testHarness/authService/AuthNRequestTest.java
2007-06-07 17:34:44 UTC (rev 2466)
+++
branches/as/src/org/perfsonar/service/testHarness/authService/AuthNRequestTest.java
2007-06-11 10:17:57 UTC (rev 2467)
@@ -157,13 +157,13 @@
AuthNRequest authnReq=new AuthNRequest(st);
AADispatchManager aadm=new AADispatchManager(new
AADispatchBasicSOAPProtocol(endPoint,inputFile,saxParser));
AuthNResponse authnRes=aadm.getAuthentication(authnReq);
- if (authnRes.getStatus()==AuthNResponse.AUTHORIZED) {
+ if (authnRes.getStatus()==AuthNResponse.AUTHENTICATED) {
System.out.println("Result: AUTHORIZED!");
}
else {
System.out.println("Result: NOT AUTHORIZED!");

}
- System.out.println("Code Result: "+authnRes.getCodeResult());
+ System.out.println("Code Result: "+authnRes.getResultCode());

} catch (Exception e) {
e.printStackTrace();

Modified:
branches/as/src/org/perfsonar/service/topologyService/TopServiceEngine.java
===================================================================
---
branches/as/src/org/perfsonar/service/topologyService/TopServiceEngine.java
2007-06-07 17:34:44 UTC (rev 2466)
+++
branches/as/src/org/perfsonar/service/topologyService/TopServiceEngine.java
2007-06-11 10:17:57 UTC (rev 2467)
@@ -226,7 +226,7 @@
resp=aaManager.getAuthentication(req);
}

- if (resp!=null&&resp.getStatus()==AuthNResponse.AUTHORIZED) {
+ if
(resp!=null&&resp.getStatus()==AuthNResponse.AUTHENTICATED) {
response = action.performAction(request);
}
else {

Modified: branches/as/src/org/perfsonar/service/web/RequestHandler.java
===================================================================
--- branches/as/src/org/perfsonar/service/web/RequestHandler.java
2007-06-07 17:34:44 UTC (rev 2466)
+++ branches/as/src/org/perfsonar/service/web/RequestHandler.java
2007-06-11 10:17:57 UTC (rev 2467)
@@ -10,6 +10,7 @@
import org.ggf.ns.nmwg.base.v2_0.Message;
import org.perfsonar.commons.auxiliary.AuxiliaryComponentManager;
import org.perfsonar.commons.auxiliary.ComponentNames;
+import org.perfsonar.commons.auxiliary.components.authn.AuthNComponent;
import
org.perfsonar.commons.auxiliary.components.configuration.ConfigurationComponent;
import org.perfsonar.commons.auxiliary.components.logger.LoggerComponent;
import org.perfsonar.commons.messages.MessageHandler;
@@ -51,6 +52,7 @@

private LoggerComponent logger = null;

+ private AuthNComponent authnComponent = null;


// ---------------------------------- public methods
@@ -65,15 +67,15 @@
* @return org.w3c.dom.Document response provided by the service
*
* @throws Exception If any fatal error occurred (but almost all errors
- * are being catched and converted to PerfSONAR result codes
+ * are being catched and converted to PerfSONAR result codes
*/
public Document acceptCall(Document request) {

/*
- *
+ *
* The first invocation of AuxiliaryComponentManager.getInstance()
* creates the static instance of AuxiliaryComponentManager.
- *
+ *
*/

try {
@@ -90,12 +92,21 @@
//get logger component

logger = (LoggerComponent)AuxiliaryComponentManager.
- getInstance().getComponent(ComponentNames.LOGGER);

+ getInstance().getComponent(ComponentNames.LOGGER);

if (logger == null) throw new PerfSONARException(
"error.common.no_logger",
"Cannot find logger component");

+ //get authn component
+
+ authnComponent = (AuthNComponent)AuxiliaryComponentManager.
+ getInstance().getComponent(ComponentNames.AUTHN);
+
+ if (authnComponent == null) throw new PerfSONARException(
+ "error.common.no_authn",
+ "Cannot find authentication component");
+
logger.info("RequestHandler: Service received a request");
logger.debug("RequestHandler: " +
"Calling on parser to parse the request");
@@ -106,12 +117,12 @@
try {

requestMessage = XMLUtils.convertToMessage(
- request,
+ request,
configuration.getProperty(SAX_PARSER_CONFIG));

} catch (Exception e) {
-
- throw new PerfSONARException("error.common.parse_error",
+
+ throw new PerfSONARException("error.common.parse_error",
"Parse/validation error, " +
"Cannot convert request to Message. " +
"Nested error messsage was "+e.getMessage());
@@ -124,7 +135,7 @@

logger.debug("RequestHandler: " +
"Message object constructed from request. " +
- "Request is of type: " +
+ "Request is of type: " +
requestMessage.getType());

/*
@@ -136,14 +147,16 @@
//if so, response that service was set up correctly
throw new PerfSONARException("service.common.success",
"Service initialized correctly");
-
+
}
-
-
+
+ // Check if it's needed authentication for this type of
message
+ authnComponent.requestAuthN(requestMessage.getType());
+
// Call on the MessageHandlerFactory to get the appropriate
// message handler for this type of message.

- MessageHandler messageHandler =
+ MessageHandler messageHandler =
MessageHandlerFactory.getMessageHandler(
requestMessage.getType());

@@ -155,7 +168,7 @@
messageHandler.getClass()+"] to satisfy request");


- //run proper message handler,
+ //run proper message handler,
//which will run ServiceEngine
//*****************************************************

@@ -177,20 +190,20 @@

} else {

- //if anything went wrong with parsing, throw exception
+ //if anything went wrong with parsing, throw exception
logger.error("RequestHandler: " +
"Message object constructed as null from request");
-
- throw new SystemException("error.common.parse_error",
+
+ throw new SystemException("error.common.parse_error",
"RequestHandler: " +
"Server could not construct a message object " +
"from the request due to unknown error. " +
"Please check request and try again");
}
-
-
- } catch (PerfSONARException pex) {

+
+ } catch (PerfSONARException pex) {
+
/*
* If any error occured
* response with result/error code
@@ -198,7 +211,7 @@

//create common result code

- Message responseMessage =
+ Message responseMessage =
ResultCodesUtil.createResultCodeMetadata(
null,
pex);
@@ -229,5 +242,5 @@

}

-
+
} //RequestHandler



  • perfsonar: r2467 - in branches/as: conf src/org/perfsonar/commons/auxiliary src/org/perfsonar/commons/auxiliary/components/authn src/org/perfsonar/commons/auxiliary/components/authn/wssec src/org/perfsonar/service/commons/authn src/org/perfsonar/service/testHarness/authService src/org/perfsonar/service/topologyService src/org/perfsonar/service/web, svnlog, 06/11/2007

Archive powered by MHonArc 2.6.16.

Top of Page