|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object issrg.test.ptb.PermisTestBench
public class PermisTestBench
This is the class for the Permis Test Bench Program. This application can be used for two purposes:
Field Summary | |
---|---|
protected PTBClock |
clock
|
protected static java.io.PrintStream |
err
|
protected boolean |
isXML
|
protected java.lang.String |
oID
|
protected static java.io.PrintStream |
out
|
protected PBAAPI |
pbaApi
|
protected PermisAction |
permisAction
|
protected PermisTarget |
permisTarget
|
protected PolicyFinder |
pfinder
|
protected java.lang.String |
rqNumber
|
protected java.lang.String |
SOA
|
protected SignatureVerifier |
sv
|
protected java.lang.String |
userDN
|
protected VirtualRepository |
vr
|
Constructor Summary | |
---|---|
PermisTestBench()
Constructs a Permis Test Bench. |
Method Summary | |
---|---|
protected void |
authenticate(java.security.Principal user)
|
void |
checkDecisionFiles(java.lang.String f1,
java.lang.String f2,
java.lang.String diff)
Compares two decision files. |
protected byte[] |
getRequestHash(java.lang.String rqFile)
Obtains the hash value of a request file |
boolean |
initialisePBAAPI()
Initialises the PBA API , that is, specifies the policy's OID,
the distinguished name of the SOA, the attribute repository to be used, and the
implementation of the SignatureInterface interface that is responsible for
verifying the digital signatures of the attribute certificates |
protected boolean |
loadAC(VirtualRepository vr,
java.lang.String filename)
Loads attribute certificates in order to insert them into the virtual repository |
protected java.lang.String[] |
loadDecision(java.io.BufferedReader in)
Reads the information related to a decision contained in a decision file. |
protected java.lang.String[] |
loadDecisionHeader(java.io.BufferedReader in)
Reads the decision header. |
boolean |
loadRepositoryFile(java.lang.String filename,
boolean check)
Reads the repository specification file. |
protected boolean |
loadRequest(java.io.BufferedReader in)
Reads a request contained in the request specification file. |
void |
loadRequestsAndGenerateDecisions(java.lang.String rqFile,
java.lang.String decisionFile)
Coordinates the rest of protected methods in order to read all the requests contained in rqFile and to generate the authositaion decisions that will
be stored in decisionFile |
protected java.lang.String[] |
loadVarValue(java.io.BufferedReader in)
Reads (attribute,value) pairs from a buffered reader. |
void |
loadXML(java.lang.String filename)
|
static void |
main(java.lang.String[] args)
|
static void |
printUsage()
Prints how to use this application |
protected boolean |
writeDecisionData(java.io.BufferedWriter out,
java.lang.String rqNumber,
java.lang.String code,
java.lang.String info,
java.lang.String additionalInfo)
Writes the decision information related to a particular request. |
protected boolean |
writeDecisionHeader(java.io.BufferedWriter out,
java.lang.String rqFile)
Writes the decision header. |
protected boolean |
writeDiffHeader(java.io.BufferedWriter out,
java.lang.String[] h1,
java.lang.String[] h2,
java.lang.String f1,
java.lang.String f2)
Reads the decision header. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.io.PrintStream out
protected static java.io.PrintStream err
protected java.lang.String SOA
protected java.lang.String oID
protected PBAAPI pbaApi
protected PTBClock clock
protected PermisAction permisAction
protected PermisTarget permisTarget
protected java.lang.String userDN
protected java.lang.String rqNumber
protected SignatureVerifier sv
protected VirtualRepository vr
protected PolicyFinder pfinder
protected boolean isXML
Constructor Detail |
---|
public PermisTestBench()
Method Detail |
---|
public static void main(java.lang.String[] args)
public static void printUsage()
protected boolean loadAC(VirtualRepository vr, java.lang.String filename)
vr
- is the virtual repositoryfilename
- is the name of the file containing the attribute certificate
public boolean loadRepositoryFile(java.lang.String filename, boolean check)
SOA_DN="distinguished name of the SOA"; NOE [1,1]
POLICY_OID="OID of the policy to enforce"; NOE [1,1]
CA="name of the file containing the identity certificate of the CA"; NOE [1,1]
SOA_CERT="name of the file containing the identity certificate of a SOA"; NOE [1,N]
POLICY_AC="name of the file containing the AC including the XML policy"; NOE [1,1]
AC="name of the file containing an AC to be stored"; NOE [0,N]
CURRENT_TIME="YYYY-MM-DD HH:MM:SS"; NOE [0,1]
If a line starts with #, it will be considered as a comment (it is ignored).
Moreover, this method also initialises the SignatureVerifier implementation to be used during the decision process.
filename
- is the name of the file specifying the repositorycheck
- indicates whether the digital signatures will be verified
AttributeRepository
and the SignatureVerifier
were initialisedprotected java.lang.String[] loadVarValue(java.io.BufferedReader in)
PARAMETER=VALUE
pattern.
Once that pattern is found, it returns an array of Strings containing the name of the
parameter in the first element and the value in the second element. On the other hand,
when the end of the buffered reader is reached, it returns null
.
in
- is the buffered reader
String[0]
is the name of the parameter;
String[1]
is the value; null if EOF
public boolean initialisePBAAPI()
PBA API
, that is, specifies the policy's OID,
the distinguished name of the SOA, the attribute repository to be used, and the
implementation of the SignatureInterface interface that is responsible for
verifying the digital signatures of the attribute certificates
PBA API
was successfully initialisedprotected boolean loadRequest(java.io.BufferedReader in)
RQ_NUMBER="number of the request being processed"; NOE [1,1]
(USER_DN || USER)="distinguished name of the requestor"; NOE [1,1]
(TARGET_DN || TARGET)="name of the requested resource (DN or URI)"; NOE [1,1]
ACTION="action being requested"; NOE [1,1]
ARG_TYPE="type of the argument"; NOE [0,N]
ARG_VALUE="value of the argument"; NOE [0,N]
If a line starts with #, it will be considered as a comment (it is ignored).
Those field must appear in the order above specified.
in
- is buffered reader related to the request file
protected boolean writeDecisionHeader(java.io.BufferedWriter out, java.lang.String rqFile)
REQUEST_FILE="name of the file containing the requests"; NOE [1,1]
REQUEST_FILE_HASH="hash value of the request file"; NOE [1,1]
EVALUATION_DATE="date on which the decisions were taken"; NOE [1,1]
out
- is buffered writer related to the decision filerqFile
- the name of the file of the input requests
protected boolean writeDecisionData(java.io.BufferedWriter out, java.lang.String rqNumber, java.lang.String code, java.lang.String info, java.lang.String additionalInfo)
RQ_NUMBER="number of the request"; NOE [1,1]
RESULT_CODE="0: allowed; 1: not allowed; 2: Invalid input; 3: Run-time error"; NOE [1,1]
RESULT_INFO="code description"; NOE [1,1]
ADDITIONAL_INFO="additional info about exceptions or errors"; NOE [1,1]
out
- is buffered writer related to the decision filerqNumber
- is the number of the requestcode
- represents the decision code taken by the PDPinfo
- contains a verbose interpretation of the decision codeadditionalInfo
- provides data related to exceptions or malformed requests
public void loadRequestsAndGenerateDecisions(java.lang.String rqFile, java.lang.String decisionFile)
rqFile
and to generate the authositaion decisions that will
be stored in decisionFile
rqFile
- is the name of the file containing the requestsdecisionFile
- is the name of the file that is going to contain the decisionsprotected java.lang.String[] loadDecisionHeader(java.io.BufferedReader in)
REQUEST_FILE="name of the file containing the requests"; NOE [1,1]
REQUEST_FILE_HASH="hash value of the request file"; NOE [1,1]
EVALUATION_DATE="date on which the decisions were taken"; NOE [1,1]
in
- is buffered reader related to the decision file
protected java.lang.String[] loadDecision(java.io.BufferedReader in)
RQ_NUMBER="number of the request"; NOE [1,1]
RESULT_CODE="0: allowed; 1: not allowed; 2: Invalid input; 3: Run-time error"; NOE [1,1]
RESULT_INFO="code description"; NOE [1,1]
ADDITIONAL_INFO="additional info about exceptions or errors"; NOE [1,1]
in
- is buffered reader related to the decision file
public void checkDecisionFiles(java.lang.String f1, java.lang.String f2, java.lang.String diff)
HEADER: (see writeDiffHeader)
FOR EACH DECISION:
[Checking request "number of request"]
[(OK) Decision codes are equal || (WN) Decision codes differ "code1" VS "code2"]
[(OK) Messages are the same || (WN) Messages Differ]
[(OK) No additional information provided || (OK) Additional notes are the same || (WN) Notes differ]
f1
- is one of the decision filesf2
- is the other decision filediff
- is the name of the file which is going to contain the differencesprotected byte[] getRequestHash(java.lang.String rqFile)
rqFile
- is name of the request file
protected boolean writeDiffHeader(java.io.BufferedWriter out, java.lang.String[] h1, java.lang.String[] h2, java.lang.String f1, java.lang.String f2)
REQUEST_FILE="name of the file containing the requests"; NOE [1,1]
REQUEST_FILE_HASH="hash value of the request file"; NOE [1,1]
EVALUATION_DATE="date on which the decisions were taken"; NOE [1,1]
out
- is buffered writer related to the diff fileh1
- contains the 3 fields of the header included in the first decision fileh2
- contains the 3 fields of the header included in the second decision filef1
- is the name of the first decision filef2
- is the name of the second decision file
public void loadXML(java.lang.String filename)
protected void authenticate(java.security.Principal user)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |