at.knowcenter.wag.egov.egiz.sig.connectors
Class BKUConnector

java.lang.Object
  extended by at.knowcenter.wag.egov.egiz.sig.connectors.BKUConnector
All Implemented Interfaces:
Connector, LocalConnector
Direct Known Subclasses:
A1Connector

public class BKUConnector
extends Object
implements LocalConnector

Connector for communicating with BKU.

Author:
wlackner, wprinz

Field Summary
static ConnectorInformation CONNECTOR_INFORMATION
          ConnectorInformation that identifies this Connector to the system.
 
Constructor Summary
BKUConnector()
          The empty constructor
 
Method Summary
 SignatureObject analyzeSignResponse(Properties response_properties, String sigType)
          Analyzes the sign response string.
 SignatureResponse analyzeVerifyResponse(Properties response_properties)
          Analyzes the verify response string.
 SignatureObject doSign(String sigType, String userName, String signText)
          This method calls the BKU signing a given text.
 SignatureResponse doVerify(String normalizedText, SignatureObject sigObject)
          This method generates the BKU verify prozess.
protected  String getConnectorValueFromProfile(String profile, String key)
           
protected  String getSignKeyboxIdentifier(String profile)
           
protected  String getSignRequestTemplateFileName(String profile)
           
 String getSignURL(String profile)
          Returns the sign URL of the local service.
protected  String getSigPropFileName(String profile)
           
protected  String getType()
          Returns the type of this BKU-like connector.
protected  String getVerifyRequestTemplateFileName(String profile)
           
 String getVerifyTemplate(String normalizedText, SignatureObject sigObject)
          This method reads the verify template from the file system and fills out the template with the SignatureObject values.
protected  String getVerifyTemplateFileName(String profile)
           
 String getVerifyURL(String profile)
          Returns the verify URL of the local service.
 String prepareSignRequest(String userName, String signText, String signType)
          Prepares the sign request string.
 String prepareVerifyRequest(String normalizedText, SignatureObject sigObject)
          Prepares the verify request string.
protected  Properties sendRequest(String url, String request_string)
          Sends the request to the given URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTOR_INFORMATION

public static final ConnectorInformation CONNECTOR_INFORMATION
ConnectorInformation that identifies this Connector to the system.

See Also:
ConnectorFactory, ConnectorInformation
Constructor Detail

BKUConnector

public BKUConnector()
             throws SignatureException
The empty constructor

Throws:
SignatureException
Method Detail

doSign

public SignatureObject doSign(String sigType,
                              String userName,
                              String signText)
                       throws SignatureException
This method calls the BKU signing a given text. The signaton type is to used initializing the corresponding SigantureObject. The initialized SignatureObject is filled out by the parsed BKU-Response.
If an error request is send back from BKU, an error message is generated an an exception is thrown.

Specified by:
doSign in interface Connector
Parameters:
sigType - the type of the SignatureObject that should be returned
userName - the name of the user calling this method
signText - the text that shoulf be signed from BKU
Returns:
the complete SingatureObject of the given type filled by values from the BKU-Request
Throws:
SignatureException
See Also:
SignatureObject

doVerify

public SignatureResponse doVerify(String normalizedText,
                                  SignatureObject sigObject)
                           throws SignatureException
This method generates the BKU verify prozess. It checks if the given SignatureObject is signed by MOA or BKU. The verify template string is filled out by the corresponding method.

Specified by:
doVerify in interface Connector
Parameters:
normalizedText - the normalized text to verify
sigObject - the SignatureObject holding the singature values
Returns:
a SignatureResponse object if the verify prozess does not fails
Throws:
SignatureException
See Also:
SignatureResponse

getVerifyTemplate

public String getVerifyTemplate(String normalizedText,
                                SignatureObject sigObject)
                         throws SignatureException
This method reads the verify template from the file system and fills out the template with the SignatureObject values.

Parameters:
normalizedText - the normalized text to veryfied
sigObject - the SignatureObject holding the singature values
Returns:
the filled verify template string
Throws:
SignatureException - ErrorCode (311, 312, 313)
See Also:
SignatureObject, CodingHelper

prepareSignRequest

public String prepareSignRequest(String userName,
                                 String signText,
                                 String signType)
                          throws SignatureException
Description copied from interface: LocalConnector
Prepares the sign request string.

Specified by:
prepareSignRequest in interface LocalConnector
Parameters:
userName - The user name.
signText - The text to be signed.
signType - The type of the signature.
Returns:
Returns the request string to be sent to the local service.
Throws:
SignatureException - F.e.

prepareVerifyRequest

public String prepareVerifyRequest(String normalizedText,
                                   SignatureObject sigObject)
                            throws SignatureException
Description copied from interface: LocalConnector
Prepares the verify request string.

Specified by:
prepareVerifyRequest in interface LocalConnector
Parameters:
normalizedText - The signed text to be verified.
sigObject - The SignatureObject.
Returns:
Returns the request string.
Throws:
SignatureException - F.e.

sendRequest

protected Properties sendRequest(String url,
                                 String request_string)
                          throws SignatureException
Sends the request to the given URL.

Parameters:
url - The URL.
request_string - The request string.
Returns:
Returns the response string.
Throws:
SignatureException - F.e.

analyzeSignResponse

public SignatureObject analyzeSignResponse(Properties response_properties,
                                           String sigType)
                                    throws SignatureException
Description copied from interface: LocalConnector
Analyzes the sign response string.

Specified by:
analyzeSignResponse in interface LocalConnector
sigType - The type of the signature.
Returns:
Returns the SignatureObject of the sign request.
Throws:
SignatureException - F.e.

analyzeVerifyResponse

public SignatureResponse analyzeVerifyResponse(Properties response_properties)
                                        throws SignatureException
Description copied from interface: LocalConnector
Analyzes the verify response string.

Specified by:
analyzeVerifyResponse in interface LocalConnector
Returns:
Returns the SignatureResponse of the verify request.
Throws:
SignatureException - F.e.

getConnectorValueFromProfile

protected String getConnectorValueFromProfile(String profile,
                                              String key)

getSignURL

public String getSignURL(String profile)
Description copied from interface: LocalConnector
Returns the sign URL of the local service.

Specified by:
getSignURL in interface LocalConnector
Parameters:
profile - The signature type the URL should be retrieved from.
Returns:
Returns the sign URL of the local service.

getSignRequestTemplateFileName

protected String getSignRequestTemplateFileName(String profile)

getSignKeyboxIdentifier

protected String getSignKeyboxIdentifier(String profile)

getVerifyURL

public String getVerifyURL(String profile)
Description copied from interface: LocalConnector
Returns the verify URL of the local service.

Specified by:
getVerifyURL in interface LocalConnector
Parameters:
profile - The signature type the URL should be retrieved from.
Returns:
Returns the verify URL of the local service.

getVerifyRequestTemplateFileName

protected String getVerifyRequestTemplateFileName(String profile)

getVerifyTemplateFileName

protected String getVerifyTemplateFileName(String profile)

getSigPropFileName

protected String getSigPropFileName(String profile)

getType

protected String getType()
Returns the type of this BKU-like connector.

All settings keys will be prefixed by this type. So to reuse the BKU connector, a deriving class has to implement this method specifying an own type.

Returns:
Returns the type of this BKU-like connector.


Copyright © 2006-2007 EGIZ - E-Government Innovationszentrum. All Rights Reserved.