Merge lp:~henrin10/reversible/reversible into lp:reversible

Proposed by Henrik Nergaard
Status: Merged
Merged at revision: 31
Proposed branch: lp:~henrin10/reversible/reversible
Merge into: lp:reversible
Diff against target: 140 lines (+42/-22)
2 files modified
anonymiser/UserAuthorisation.py (+36/-22)
anonymiser/reversible-anonymiser.sh (+6/-0)
To merge this branch: bzr merge lp:~henrin10/reversible/reversible
Reviewer Review Type Date Requested Status
Nils Ulltveit-Moe Pending
Review via email: mp+291769@code.launchpad.net

Description of the change

amqps output support

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'anonymiser/UserAuthorisation.py'
2--- anonymiser/UserAuthorisation.py 2016-01-03 20:28:12 +0000
3+++ anonymiser/UserAuthorisation.py 2016-04-13 15:02:48 +0000
4@@ -74,15 +74,17 @@
5 self.cache=None
6 self.producers=[] # Producer thread(s)
7 self.consumers=[] # Consumer thread(s)
8- self.makeRequest=XACMLCacheAuthRequest()
9+ self.makeRequest=XACMLCacheAuthRequest()
10
11 def authoriseDataConsumer(self, SERVICE_ENDPOINT, user, resource, action):
12+
13 """
14 Authorise a new consumer to read the XACML data stream.
15 The initial authorisation response contains obligations that
16 are used to set up the consumer object.
17 FIXME: This belongs in the SOAP stubs section...
18 """
19+
20 # Preferred method is passing in a parsed DOM tree.
21 # I use the convenience method that accepts an input string for now.
22 # FIXME later: use a validating DOM parser instead of the intermediate solution below.
23@@ -91,7 +93,7 @@
24 request = self.makeRequest.initialRequest(user, resource, action)
25
26 # Evaluate the XACML request
27- #self.logger.info(request)
28+ #self.logger.info(request)
29
30 requestHandle=RequestCtx.getInstance(ByteArrayInputStream(request))
31 response=self.pdp.evaluate(requestHandle)
32@@ -105,59 +107,71 @@
33 # Full logic to be added later.
34
35 if results[0].DECISIONS[results[0].decision] == "Permit":
36- # OK - I am authorised to the PEP. Set up the caching specification for this data consumer.
37+ # OK - I am authorised to the PEP. Set up the caching specification for this data consumer.
38
39 # Do key handling before any threading starts.
40 pubkey, privkey = generateRSAKeyPair("Anonymiser")
41
42
43 # Set up the decision cache
44- self.cache=XACMLDecisionCache(self.pdp, results, user)
45+ self.cache=XACMLDecisionCache(self.pdp, results, user)
46
47- # Print the caching specification (debugging)
48- #self.logger.info(str(self.cache.cacheSpecification))
49+ # Print the caching specification (debugging)
50+ # self.logger.info(str(self.cache.cacheSpecification))
51
52 # Set up the output thread plugin.
53 se = urlparse(SERVICE_ENDPOINT)
54+
55 if se.scheme == "http":
56- from anonymiserlib.HTTPSOutputThread import HTTPOutputThread
57- outThread = HTTPOutputThread(SERVICE_ENDPOINT)
58+ from anonymiserlib.HTTPSOutputThread import HTTPOutputThread
59+ outThread = HTTPOutputThread(SERVICE_ENDPOINT)
60+
61 elif se.scheme == "https":
62- from anonymiserlib.HTTPSOutputThread import SSLOutputThread
63+ from anonymiserlib.HTTPSOutputThread import SSLOutputThread
64 outThread = SSLOutputThread(SERVICE_ENDPOINT)
65+
66 elif se.scheme == "amqp":
67- from anonymiserlib.RabbitOutputThread import RabbitOutputThread
68- outThread = RabbitOutputThread(SERVICE_ENDPOINT)
69+ from anonymiserlib.RabbitOutputThread import RabbitOutputThread
70+ outThread = RabbitOutputThread(SERVICE_ENDPOINT)
71+
72 elif se.scheme == "amqps":
73- raise NotImplementedException("amqps:// protocol not yet implemented.")
74+ from anonymiserlib.RabbitSSLOutputThread import RabbitSSLOutputThread
75+ outThread = RabbitSSLOutputThread(SERVICE_ENDPOINT)
76+
77 elif se.scheme == "text":
78- from anonymiserlib.TextOutputThread import TextOutputThread
79- outThread = TextOutputThread(SERVICE_ENDPOINT)
80-
81+ from anonymiserlib.TextOutputThread import TextOutputThread
82+ outThread = TextOutputThread(SERVICE_ENDPOINT)
83+
84+ else
85+ raise NotImplementedException("Error [ " + se.scheme + " ]. This scheme is not implemented, or formatted wrongly")
86+
87 self.producers.append(outThread)
88
89 # Start the output thread.
90 outThread.start()
91
92- # Create a new data consumer, read cache spec and set up crypto keys etc.
93- adc=AnonymisedDataConsumer(self.cache, outThread, self.profileData)
94+ # Create a new data consumer, read cache spec and set up crypto keys etc.
95+ adc=AnonymisedDataConsumer(self.cache, outThread, self.profileData)
96
97 # Set up crypto specification.
98 adc.cryptoSpecification(pubkey, privkey, self.cache.keyMap, self.cache.pubKeyMap)
99
100- # Start the data consumer thread
101+ # Start the data consumer thread
102 # ====================================================#
103 # WARNING: CONSUMER THREAD (ANONOMISER) STARTS HERE. #
104 # NO THREAD UNSAFE CODE #
105 # BELOW THIS LINE... OR CODE WILL BREAK... #
106 # ====================================================#
107- # Add the data consumer thread to the list of active consumers
108- self.consumers.append(adc)
109+
110+ # Add the data consumer thread to the list of active consumers
111+ self.consumers.append(adc)
112+
113 # and start the thread.
114- adc.start()
115+ adc.start()
116+
117 else:
118 # Did not get access.
119- raise AccessDeniedException("Initial authorisation: Access denied for "+user)
120+ raise AccessDeniedException("Initial authorisation: Access denied for " + user)
121
122 # Return the XACML response for now.
123 return results[0].DECISIONS[results[0].decision]
124
125=== modified file 'anonymiser/reversible-anonymiser.sh'
126--- anonymiser/reversible-anonymiser.sh 2016-01-03 13:35:06 +0000
127+++ anonymiser/reversible-anonymiser.sh 2016-04-13 15:02:48 +0000
128@@ -57,6 +57,12 @@
129 # PRECYSE ESB server interface
130 export CLASSPATH=$CLASSPATH:../idmefStreamServer/lib/precysePublishStreamInterface.jar
131
132+# JAR files for AMQPS support
133+for MQJAR in ${REVERSIBLE_HOME}/../amqps/*.jar
134+do
135+ export CLASSPATH="$CLASSPATH:$MQJAR"
136+done
137+
138 echo $CLASSPATH
139
140 echo "Starting anonymiser, please wait..."

Subscribers

People subscribed via source and target branches