Revision 065ce8c1
b/src/gr/ebs/gss/server/domain/FileLock.java | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2011 Electronic Business Systems Ltd. |
|
3 |
* |
|
4 |
* This file is part of GSS. |
|
5 |
* |
|
6 |
* GSS is free software: you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation, either version 3 of the License, or |
|
9 |
* (at your option) any later version. |
|
10 |
* |
|
11 |
* GSS is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with GSS. If not, see <http://www.gnu.org/licenses/>. |
|
18 |
*/ |
|
19 |
package gr.ebs.gss.server.domain; |
|
20 |
|
|
21 |
import java.util.Date; |
|
22 |
|
|
23 |
import javax.persistence.Column; |
|
24 |
import javax.persistence.Entity; |
|
25 |
import javax.persistence.Id; |
|
26 |
import javax.persistence.Temporal; |
|
27 |
import javax.persistence.TemporalType; |
|
28 |
import javax.persistence.Version; |
|
29 |
|
|
30 |
import org.hibernate.annotations.CollectionOfElements; |
|
31 |
import org.hibernate.annotations.IndexColumn; |
|
32 |
|
|
33 |
import com.bradmcevoy.http.LockInfo; |
|
34 |
import com.bradmcevoy.http.LockTimeout; |
|
35 |
import com.bradmcevoy.http.LockToken; |
|
36 |
import com.bradmcevoy.http.LockInfo.LockDepth; |
|
37 |
import com.bradmcevoy.http.LockInfo.LockScope; |
|
38 |
import com.bradmcevoy.http.LockInfo.LockType; |
|
39 |
|
|
40 |
|
|
41 |
/** |
|
42 |
* @author kman |
|
43 |
* |
|
44 |
*/ |
|
45 |
@Entity |
|
46 |
public class FileLock { |
|
47 |
@Id |
|
48 |
String id; |
|
49 |
public String lockedByUser; |
|
50 |
@Temporal(TemporalType.TIMESTAMP) |
|
51 |
@Column(name="from_date") |
|
52 |
Date from; |
|
53 |
String tokenId; |
|
54 |
|
|
55 |
public LockScope scope; |
|
56 |
public LockType type; |
|
57 |
public LockDepth depth; |
|
58 |
|
|
59 |
Long seconds; |
|
60 |
@CollectionOfElements |
|
61 |
@IndexColumn(name="secId") |
|
62 |
Long[] otherSeconds; |
|
63 |
@Version |
|
64 |
private int version; |
|
65 |
|
|
66 |
/** |
|
67 |
* |
|
68 |
*/ |
|
69 |
public FileLock() { |
|
70 |
// TODO Auto-generated constructor stub |
|
71 |
} |
|
72 |
|
|
73 |
public FileLock(String id,LockToken token){ |
|
74 |
this.id=id; |
|
75 |
this.tokenId=token.tokenId; |
|
76 |
if(token.info!=null){ |
|
77 |
this.depth=token.info.depth; |
|
78 |
this.scope=token.info.scope; |
|
79 |
this.type=token.info.type; |
|
80 |
this.lockedByUser=token.info.lockedByUser; |
|
81 |
} |
|
82 |
if(token.timeout!=null){ |
|
83 |
this.seconds=token.timeout.getSeconds(); |
|
84 |
this.otherSeconds=token.timeout.getOtherSeconds(); |
|
85 |
} |
|
86 |
this.from=token.getFrom(); |
|
87 |
|
|
88 |
} |
|
89 |
|
|
90 |
public LockToken toToken(){ |
|
91 |
LockToken res = new LockToken(); |
|
92 |
res.tokenId=tokenId; |
|
93 |
LockInfo info = new LockInfo(scope,type,lockedByUser,depth); |
|
94 |
LockTimeout timeout = new LockTimeout(seconds); |
|
95 |
res.timeout=timeout; |
|
96 |
res.info=info; |
|
97 |
res.setFrom(from); |
|
98 |
return res; |
|
99 |
} |
|
100 |
|
|
101 |
|
|
102 |
/** |
|
103 |
* Retrieve the id. |
|
104 |
* |
|
105 |
* @return the id |
|
106 |
*/ |
|
107 |
public String getId() { |
|
108 |
return id; |
|
109 |
} |
|
110 |
|
|
111 |
|
|
112 |
/** |
|
113 |
* Modify the id. |
|
114 |
* |
|
115 |
* @param id the id to set |
|
116 |
*/ |
|
117 |
public void setId(String id) { |
|
118 |
this.id = id; |
|
119 |
} |
|
120 |
|
|
121 |
|
|
122 |
/** |
|
123 |
* Retrieve the lockedByUser. |
|
124 |
* |
|
125 |
* @return the lockedByUser |
|
126 |
*/ |
|
127 |
public String getLockedByUser() { |
|
128 |
return lockedByUser; |
|
129 |
} |
|
130 |
|
|
131 |
|
|
132 |
/** |
|
133 |
* Modify the lockedByUser. |
|
134 |
* |
|
135 |
* @param lockedByUser the lockedByUser to set |
|
136 |
*/ |
|
137 |
public void setLockedByUser(String lockedByUser) { |
|
138 |
this.lockedByUser = lockedByUser; |
|
139 |
} |
|
140 |
|
|
141 |
|
|
142 |
/** |
|
143 |
* Retrieve the from. |
|
144 |
* |
|
145 |
* @return the from |
|
146 |
*/ |
|
147 |
public Date getFrom() { |
|
148 |
return from; |
|
149 |
} |
|
150 |
|
|
151 |
|
|
152 |
/** |
|
153 |
* Modify the from. |
|
154 |
* |
|
155 |
* @param from the from to set |
|
156 |
*/ |
|
157 |
public void setFrom(Date from) { |
|
158 |
this.from = from; |
|
159 |
} |
|
160 |
|
|
161 |
|
|
162 |
/** |
|
163 |
* Retrieve the tokenId. |
|
164 |
* |
|
165 |
* @return the tokenId |
|
166 |
*/ |
|
167 |
public String getTokenId() { |
|
168 |
return tokenId; |
|
169 |
} |
|
170 |
|
|
171 |
|
|
172 |
/** |
|
173 |
* Modify the tokenId. |
|
174 |
* |
|
175 |
* @param tokenId the tokenId to set |
|
176 |
*/ |
|
177 |
public void setTokenId(String tokenId) { |
|
178 |
this.tokenId = tokenId; |
|
179 |
} |
|
180 |
|
|
181 |
|
|
182 |
/** |
|
183 |
* Retrieve the scope. |
|
184 |
* |
|
185 |
* @return the scope |
|
186 |
*/ |
|
187 |
public LockScope getScope() { |
|
188 |
return scope; |
|
189 |
} |
|
190 |
|
|
191 |
|
|
192 |
/** |
|
193 |
* Modify the scope. |
|
194 |
* |
|
195 |
* @param scope the scope to set |
|
196 |
*/ |
|
197 |
public void setScope(LockScope scope) { |
|
198 |
this.scope = scope; |
|
199 |
} |
|
200 |
|
|
201 |
|
|
202 |
/** |
|
203 |
* Retrieve the type. |
|
204 |
* |
|
205 |
* @return the type |
|
206 |
*/ |
|
207 |
public LockType getType() { |
|
208 |
return type; |
|
209 |
} |
|
210 |
|
|
211 |
|
|
212 |
/** |
|
213 |
* Modify the type. |
|
214 |
* |
|
215 |
* @param type the type to set |
|
216 |
*/ |
|
217 |
public void setType(LockType type) { |
|
218 |
this.type = type; |
|
219 |
} |
|
220 |
|
|
221 |
|
|
222 |
/** |
|
223 |
* Retrieve the depth. |
|
224 |
* |
|
225 |
* @return the depth |
|
226 |
*/ |
|
227 |
public LockDepth getDepth() { |
|
228 |
return depth; |
|
229 |
} |
|
230 |
|
|
231 |
|
|
232 |
/** |
|
233 |
* Modify the depth. |
|
234 |
* |
|
235 |
* @param depth the depth to set |
|
236 |
*/ |
|
237 |
public void setDepth(LockDepth depth) { |
|
238 |
this.depth = depth; |
|
239 |
} |
|
240 |
|
|
241 |
|
|
242 |
/** |
|
243 |
* Retrieve the seconds. |
|
244 |
* |
|
245 |
* @return the seconds |
|
246 |
*/ |
|
247 |
public Long getSeconds() { |
|
248 |
return seconds; |
|
249 |
} |
|
250 |
|
|
251 |
|
|
252 |
/** |
|
253 |
* Modify the seconds. |
|
254 |
* |
|
255 |
* @param seconds the seconds to set |
|
256 |
*/ |
|
257 |
public void setSeconds(Long seconds) { |
|
258 |
this.seconds = seconds; |
|
259 |
} |
|
260 |
|
|
261 |
|
|
262 |
/** |
|
263 |
* Retrieve the otherSeconds. |
|
264 |
* |
|
265 |
* @return the otherSeconds |
|
266 |
*/ |
|
267 |
public Long[] getOtherSeconds() { |
|
268 |
return otherSeconds; |
|
269 |
} |
|
270 |
|
|
271 |
|
|
272 |
/** |
|
273 |
* Modify the otherSeconds. |
|
274 |
* |
|
275 |
* @param otherSeconds the otherSeconds to set |
|
276 |
*/ |
|
277 |
public void setOtherSeconds(Long[] otherSeconds) { |
|
278 |
this.otherSeconds = otherSeconds; |
|
279 |
} |
|
280 |
|
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
} |
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2011 Electronic Business Systems Ltd. |
|
3 |
* |
|
4 |
* This file is part of GSS. |
|
5 |
* |
|
6 |
* GSS is free software: you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation, either version 3 of the License, or |
|
9 |
* (at your option) any later version. |
|
10 |
* |
|
11 |
* GSS is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with GSS. If not, see <http://www.gnu.org/licenses/>. |
|
18 |
*/ |
|
19 |
package gr.ebs.gss.server.domain; |
|
20 |
|
|
21 |
import java.util.Date; |
|
22 |
|
|
23 |
import javax.persistence.Column; |
|
24 |
import javax.persistence.Entity; |
|
25 |
import javax.persistence.Id; |
|
26 |
import javax.persistence.Temporal; |
|
27 |
import javax.persistence.TemporalType; |
|
28 |
import javax.persistence.Version; |
|
29 |
|
|
30 |
import org.hibernate.annotations.CollectionOfElements; |
|
31 |
import org.hibernate.annotations.IndexColumn; |
|
32 |
|
|
33 |
import com.bradmcevoy.http.LockInfo; |
|
34 |
import com.bradmcevoy.http.LockTimeout; |
|
35 |
import com.bradmcevoy.http.LockToken; |
|
36 |
import com.bradmcevoy.http.LockInfo.LockDepth; |
|
37 |
import com.bradmcevoy.http.LockInfo.LockScope; |
|
38 |
import com.bradmcevoy.http.LockInfo.LockType; |
|
39 |
|
|
40 |
|
|
41 |
/** |
|
42 |
* @author kman |
|
43 |
* |
|
44 |
*/ |
|
45 |
@Entity |
|
46 |
public class GssLock { |
|
47 |
@Id |
|
48 |
String id; |
|
49 |
public String lockedByUser; |
|
50 |
@Temporal(TemporalType.TIMESTAMP) |
|
51 |
@Column(name="from_date") |
|
52 |
Date from; |
|
53 |
String tokenId; |
|
54 |
|
|
55 |
public LockScope scope; |
|
56 |
public LockType type; |
|
57 |
public LockDepth depth; |
|
58 |
|
|
59 |
Long seconds; |
|
60 |
@CollectionOfElements |
|
61 |
@IndexColumn(name="secId") |
|
62 |
Long[] otherSeconds; |
|
63 |
@Version |
|
64 |
private int version; |
|
65 |
|
|
66 |
/** |
|
67 |
* |
|
68 |
*/ |
|
69 |
public GssLock() { |
|
70 |
// TODO Auto-generated constructor stub |
|
71 |
} |
|
72 |
|
|
73 |
public GssLock(String id,LockToken token){ |
|
74 |
this.id=id; |
|
75 |
this.tokenId=token.tokenId; |
|
76 |
if(token.info!=null){ |
|
77 |
this.depth=token.info.depth; |
|
78 |
this.scope=token.info.scope; |
|
79 |
this.type=token.info.type; |
|
80 |
this.lockedByUser=token.info.lockedByUser; |
|
81 |
} |
|
82 |
if(token.timeout!=null){ |
|
83 |
this.seconds=token.timeout.getSeconds(); |
|
84 |
this.otherSeconds=token.timeout.getOtherSeconds(); |
|
85 |
} |
|
86 |
this.from=token.getFrom(); |
|
87 |
|
|
88 |
} |
|
89 |
|
|
90 |
public LockToken toToken(){ |
|
91 |
LockToken res = new LockToken(); |
|
92 |
res.tokenId=tokenId; |
|
93 |
LockInfo info = new LockInfo(scope,type,lockedByUser,depth); |
|
94 |
LockTimeout timeout = new LockTimeout(seconds); |
|
95 |
res.timeout=timeout; |
|
96 |
res.info=info; |
|
97 |
res.setFrom(from); |
|
98 |
return res; |
|
99 |
} |
|
100 |
|
|
101 |
|
|
102 |
/** |
|
103 |
* Retrieve the id. |
|
104 |
* |
|
105 |
* @return the id |
|
106 |
*/ |
|
107 |
public String getId() { |
|
108 |
return id; |
|
109 |
} |
|
110 |
|
|
111 |
|
|
112 |
/** |
|
113 |
* Modify the id. |
|
114 |
* |
|
115 |
* @param id the id to set |
|
116 |
*/ |
|
117 |
public void setId(String id) { |
|
118 |
this.id = id; |
|
119 |
} |
|
120 |
|
|
121 |
|
|
122 |
/** |
|
123 |
* Retrieve the lockedByUser. |
|
124 |
* |
|
125 |
* @return the lockedByUser |
|
126 |
*/ |
|
127 |
public String getLockedByUser() { |
|
128 |
return lockedByUser; |
|
129 |
} |
|
130 |
|
|
131 |
|
|
132 |
/** |
|
133 |
* Modify the lockedByUser. |
|
134 |
* |
|
135 |
* @param lockedByUser the lockedByUser to set |
|
136 |
*/ |
|
137 |
public void setLockedByUser(String lockedByUser) { |
|
138 |
this.lockedByUser = lockedByUser; |
|
139 |
} |
|
140 |
|
|
141 |
|
|
142 |
/** |
|
143 |
* Retrieve the from. |
|
144 |
* |
|
145 |
* @return the from |
|
146 |
*/ |
|
147 |
public Date getFrom() { |
|
148 |
return from; |
|
149 |
} |
|
150 |
|
|
151 |
|
|
152 |
/** |
|
153 |
* Modify the from. |
|
154 |
* |
|
155 |
* @param from the from to set |
|
156 |
*/ |
|
157 |
public void setFrom(Date from) { |
|
158 |
this.from = from; |
|
159 |
} |
|
160 |
|
|
161 |
|
|
162 |
/** |
|
163 |
* Retrieve the tokenId. |
|
164 |
* |
|
165 |
* @return the tokenId |
|
166 |
*/ |
|
167 |
public String getTokenId() { |
|
168 |
return tokenId; |
|
169 |
} |
|
170 |
|
|
171 |
|
|
172 |
/** |
|
173 |
* Modify the tokenId. |
|
174 |
* |
|
175 |
* @param tokenId the tokenId to set |
|
176 |
*/ |
|
177 |
public void setTokenId(String tokenId) { |
|
178 |
this.tokenId = tokenId; |
|
179 |
} |
|
180 |
|
|
181 |
|
|
182 |
/** |
|
183 |
* Retrieve the scope. |
|
184 |
* |
|
185 |
* @return the scope |
|
186 |
*/ |
|
187 |
public LockScope getScope() { |
|
188 |
return scope; |
|
189 |
} |
|
190 |
|
|
191 |
|
|
192 |
/** |
|
193 |
* Modify the scope. |
|
194 |
* |
|
195 |
* @param scope the scope to set |
|
196 |
*/ |
|
197 |
public void setScope(LockScope scope) { |
|
198 |
this.scope = scope; |
|
199 |
} |
|
200 |
|
|
201 |
|
|
202 |
/** |
|
203 |
* Retrieve the type. |
|
204 |
* |
|
205 |
* @return the type |
|
206 |
*/ |
|
207 |
public LockType getType() { |
|
208 |
return type; |
|
209 |
} |
|
210 |
|
|
211 |
|
|
212 |
/** |
|
213 |
* Modify the type. |
|
214 |
* |
|
215 |
* @param type the type to set |
|
216 |
*/ |
|
217 |
public void setType(LockType type) { |
|
218 |
this.type = type; |
|
219 |
} |
|
220 |
|
|
221 |
|
|
222 |
/** |
|
223 |
* Retrieve the depth. |
|
224 |
* |
|
225 |
* @return the depth |
|
226 |
*/ |
|
227 |
public LockDepth getDepth() { |
|
228 |
return depth; |
|
229 |
} |
|
230 |
|
|
231 |
|
|
232 |
/** |
|
233 |
* Modify the depth. |
|
234 |
* |
|
235 |
* @param depth the depth to set |
|
236 |
*/ |
|
237 |
public void setDepth(LockDepth depth) { |
|
238 |
this.depth = depth; |
|
239 |
} |
|
240 |
|
|
241 |
|
|
242 |
/** |
|
243 |
* Retrieve the seconds. |
|
244 |
* |
|
245 |
* @return the seconds |
|
246 |
*/ |
|
247 |
public Long getSeconds() { |
|
248 |
return seconds; |
|
249 |
} |
|
250 |
|
|
251 |
|
|
252 |
/** |
|
253 |
* Modify the seconds. |
|
254 |
* |
|
255 |
* @param seconds the seconds to set |
|
256 |
*/ |
|
257 |
public void setSeconds(Long seconds) { |
|
258 |
this.seconds = seconds; |
|
259 |
} |
|
260 |
|
|
261 |
|
|
262 |
/** |
|
263 |
* Retrieve the otherSeconds. |
|
264 |
* |
|
265 |
* @return the otherSeconds |
|
266 |
*/ |
|
267 |
public Long[] getOtherSeconds() { |
|
268 |
return otherSeconds; |
|
269 |
} |
|
270 |
|
|
271 |
|
|
272 |
/** |
|
273 |
* Modify the otherSeconds. |
|
274 |
* |
|
275 |
* @param otherSeconds the otherSeconds to set |
|
276 |
*/ |
|
277 |
public void setOtherSeconds(Long[] otherSeconds) { |
|
278 |
this.otherSeconds = otherSeconds; |
|
279 |
} |
|
280 |
|
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
} |
b/src/gr/ebs/gss/server/domain/WebDavNonce.java | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2011 Electronic Business Systems Ltd. |
|
3 |
* |
|
4 |
* This file is part of GSS. |
|
5 |
* |
|
6 |
* GSS is free software: you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation, either version 3 of the License, or |
|
9 |
* (at your option) any later version. |
|
10 |
* |
|
11 |
* GSS is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with GSS. If not, see <http://www.gnu.org/licenses/>. |
|
18 |
*/ |
|
19 |
package gr.ebs.gss.server.domain; |
|
20 |
|
|
21 |
import java.util.Date; |
|
22 |
|
|
23 |
import javax.persistence.Entity; |
|
24 |
import javax.persistence.Id; |
|
25 |
import javax.persistence.Temporal; |
|
26 |
import javax.persistence.TemporalType; |
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* @author kman |
|
31 |
* |
|
32 |
*/ |
|
33 |
@Entity |
|
34 |
public class WebDavNonce { |
|
35 |
@Id |
|
36 |
String id; |
|
37 |
@Temporal(TemporalType.TIMESTAMP) |
|
38 |
Date issued; |
|
39 |
long nonceCount=0; |
|
40 |
|
|
41 |
/** |
|
42 |
* Retrieve the id. |
|
43 |
* |
|
44 |
* @return the id |
|
45 |
*/ |
|
46 |
public String getId() { |
|
47 |
return id; |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* Modify the id. |
|
52 |
* |
|
53 |
* @param id the id to set |
|
54 |
*/ |
|
55 |
public void setId(String id) { |
|
56 |
this.id = id; |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* Retrieve the issued. |
|
61 |
* |
|
62 |
* @return the issued |
|
63 |
*/ |
|
64 |
public Date getIssued() { |
|
65 |
return issued; |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* Modify the issued. |
|
70 |
* |
|
71 |
* @param issued the issued to set |
|
72 |
*/ |
|
73 |
public void setIssued(Date issued) { |
|
74 |
this.issued = issued; |
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* Retrieve the nonceCount. |
|
79 |
* |
|
80 |
* @return the nonceCount |
|
81 |
*/ |
|
82 |
public long getNonceCount() { |
|
83 |
return nonceCount; |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Modify the nonceCount. |
|
88 |
* |
|
89 |
* @param nonceCount the nonceCount to set |
|
90 |
*/ |
|
91 |
public void setNonceCount(long nonceCount) { |
|
92 |
this.nonceCount = nonceCount; |
|
93 |
} |
|
94 |
|
|
95 |
|
|
96 |
} |
b/src/gr/ebs/gss/server/ejb/ExternalAPI.java | ||
---|---|---|
26 | 26 |
import gr.ebs.gss.client.exceptions.QuotaExceededException; |
27 | 27 |
import gr.ebs.gss.server.domain.FileHeader; |
28 | 28 |
import gr.ebs.gss.server.domain.FileUploadStatus; |
29 |
import gr.ebs.gss.server.domain.GssLock;
|
|
29 |
import gr.ebs.gss.server.domain.FileLock;
|
|
30 | 30 |
import gr.ebs.gss.server.domain.Invitation; |
31 | 31 |
import gr.ebs.gss.server.domain.Nonce; |
32 | 32 |
import gr.ebs.gss.server.domain.User; |
33 | 33 |
import gr.ebs.gss.server.domain.UserClass; |
34 | 34 |
import gr.ebs.gss.server.domain.UserLogin; |
35 |
import gr.ebs.gss.server.domain.WebDavNonce; |
|
35 | 36 |
import gr.ebs.gss.server.domain.dto.FileBodyDTO; |
36 | 37 |
import gr.ebs.gss.server.domain.dto.FileHeaderDTO; |
37 | 38 |
import gr.ebs.gss.server.domain.dto.FolderDTO; |
... | ... | |
1251 | 1252 |
* @param lock |
1252 | 1253 |
* @return |
1253 | 1254 |
*/ |
1254 |
GssLock saveOrUpdateLock(GssLock lock);
|
|
1255 |
FileLock saveOrUpdateLock(FileLock lock);
|
|
1255 | 1256 |
|
1256 | 1257 |
/** |
1257 | 1258 |
* @param lock |
1258 | 1259 |
*/ |
1259 |
void removeLock(GssLock lock);
|
|
1260 |
void removeLock(FileLock lock);
|
|
1260 | 1261 |
|
1261 | 1262 |
/** |
1262 | 1263 |
* @param tokenId |
1263 | 1264 |
* @return |
1264 | 1265 |
*/ |
1265 |
GssLock getLockByToken(String tokenId);
|
|
1266 |
FileLock getLockByToken(String tokenId);
|
|
1266 | 1267 |
|
1267 | 1268 |
/** |
1268 | 1269 |
* @param id |
1269 | 1270 |
* @return |
1270 | 1271 |
*/ |
1271 |
GssLock getLockById(String id);
|
|
1272 |
FileLock getLockById(String id);
|
|
1272 | 1273 |
|
1273 | 1274 |
/** |
1274 | 1275 |
* @param userId |
... | ... | |
1282 | 1283 |
* @throws QuotaExceededException |
1283 | 1284 |
*/ |
1284 | 1285 |
FileHeaderDTO createEmptyFile(Long userId, Long folderId, String name) throws DuplicateNameException, ObjectNotFoundException, GSSIOException, InsufficientPermissionsException, QuotaExceededException; |
1286 |
|
|
1287 |
/** |
|
1288 |
* @param nonce |
|
1289 |
* @return |
|
1290 |
*/ |
|
1291 |
WebDavNonce saveOrUpdateWebDavNonce(WebDavNonce nonce); |
|
1292 |
|
|
1293 |
/** |
|
1294 |
* @param nonce |
|
1295 |
*/ |
|
1296 |
void removeWebDavNonce(WebDavNonce nonce); |
|
1297 |
|
|
1298 |
/** |
|
1299 |
* @param tokenId |
|
1300 |
* @return |
|
1301 |
*/ |
|
1302 |
WebDavNonce getWebDavNonce(String tokenId); |
|
1285 | 1303 |
|
1286 | 1304 |
|
1287 | 1305 |
|
b/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java | ||
---|---|---|
34 | 34 |
import gr.ebs.gss.server.domain.FileUploadStatus; |
35 | 35 |
import gr.ebs.gss.server.domain.Folder; |
36 | 36 |
import gr.ebs.gss.server.domain.Group; |
37 |
import gr.ebs.gss.server.domain.GssLock;
|
|
37 |
import gr.ebs.gss.server.domain.FileLock;
|
|
38 | 38 |
import gr.ebs.gss.server.domain.Invitation; |
39 | 39 |
import gr.ebs.gss.server.domain.Nonce; |
40 | 40 |
import gr.ebs.gss.server.domain.Permission; |
41 | 41 |
import gr.ebs.gss.server.domain.User; |
42 | 42 |
import gr.ebs.gss.server.domain.UserClass; |
43 | 43 |
import gr.ebs.gss.server.domain.UserLogin; |
44 |
import gr.ebs.gss.server.domain.WebDavNonce; |
|
44 | 45 |
import gr.ebs.gss.server.domain.dto.FileBodyDTO; |
45 | 46 |
import gr.ebs.gss.server.domain.dto.FileHeaderDTO; |
46 | 47 |
import gr.ebs.gss.server.domain.dto.FolderDTO; |
... | ... | |
2834 | 2835 |
} |
2835 | 2836 |
/*** WEBDAV LOCK **/ |
2836 | 2837 |
@Override |
2837 |
public GssLock getLockById(String id) {
|
|
2838 |
public FileLock getLockById(String id) {
|
|
2838 | 2839 |
return dao.getLockById(id); |
2839 | 2840 |
} |
2840 | 2841 |
|
2841 | 2842 |
@Override |
2842 |
public GssLock getLockByToken(String tokenId) {
|
|
2843 |
public FileLock getLockByToken(String tokenId) {
|
|
2843 | 2844 |
return dao.getLockByToken(tokenId); |
2844 | 2845 |
} |
2845 | 2846 |
|
2846 | 2847 |
@Override |
2847 |
public void removeLock(GssLock lock) {
|
|
2848 |
public void removeLock(FileLock lock) {
|
|
2848 | 2849 |
dao.removeLock(lock); |
2849 | 2850 |
} |
2850 | 2851 |
|
2851 | 2852 |
@Override |
2852 |
public GssLock saveOrUpdateLock(GssLock lock) {
|
|
2853 |
public FileLock saveOrUpdateLock(FileLock lock) {
|
|
2853 | 2854 |
return dao.saveOrUpdateLock(lock); |
2854 | 2855 |
} |
2856 |
|
|
2857 |
@Override |
|
2858 |
public WebDavNonce getWebDavNonce(String tokenId) { |
|
2859 |
return dao.getWebDavNonce(tokenId); |
|
2860 |
} |
|
2861 |
|
|
2862 |
@Override |
|
2863 |
public void removeWebDavNonce(WebDavNonce nonce) { |
|
2864 |
dao.removeWebDavNonce(nonce); |
|
2865 |
} |
|
2866 |
|
|
2867 |
@Override |
|
2868 |
public WebDavNonce saveOrUpdateWebDavNonce(WebDavNonce nonce) { |
|
2869 |
return dao.saveOrUpdateWebDavNonce(nonce); |
|
2870 |
} |
|
2855 | 2871 |
} |
b/src/gr/ebs/gss/server/ejb/GSSDAO.java | ||
---|---|---|
25 | 25 |
import gr.ebs.gss.server.domain.FileUploadStatus; |
26 | 26 |
import gr.ebs.gss.server.domain.Folder; |
27 | 27 |
import gr.ebs.gss.server.domain.Group; |
28 |
import gr.ebs.gss.server.domain.GssLock;
|
|
28 |
import gr.ebs.gss.server.domain.FileLock;
|
|
29 | 29 |
import gr.ebs.gss.server.domain.Invitation; |
30 | 30 |
import gr.ebs.gss.server.domain.Nonce; |
31 | 31 |
import gr.ebs.gss.server.domain.User; |
32 | 32 |
import gr.ebs.gss.server.domain.UserClass; |
33 | 33 |
import gr.ebs.gss.server.domain.UserLogin; |
34 |
import gr.ebs.gss.server.domain.WebDavNonce; |
|
34 | 35 |
|
35 | 36 |
import java.util.Date; |
36 | 37 |
import java.util.List; |
... | ... | |
542 | 543 |
* @param id |
543 | 544 |
* @return |
544 | 545 |
*/ |
545 |
GssLock getLockById(String id);
|
|
546 |
FileLock getLockById(String id);
|
|
546 | 547 |
|
547 | 548 |
/** |
548 | 549 |
* @param tokenId |
549 | 550 |
* @return |
550 | 551 |
*/ |
551 |
GssLock getLockByToken(String tokenId);
|
|
552 |
FileLock getLockByToken(String tokenId);
|
|
552 | 553 |
|
553 | 554 |
/** |
554 | 555 |
* @param lock |
555 | 556 |
*/ |
556 |
void removeLock(GssLock lock);
|
|
557 |
void removeLock(FileLock lock);
|
|
557 | 558 |
|
558 | 559 |
/** |
559 | 560 |
* @param lock |
560 | 561 |
* @return |
561 | 562 |
*/ |
562 |
GssLock saveOrUpdateLock(GssLock lock); |
|
563 |
FileLock saveOrUpdateLock(FileLock lock); |
|
564 |
|
|
565 |
/** |
|
566 |
* @param lock |
|
567 |
* @return |
|
568 |
*/ |
|
569 |
WebDavNonce saveOrUpdateWebDavNonce(WebDavNonce lock); |
|
570 |
|
|
571 |
/** |
|
572 |
* @param lock |
|
573 |
*/ |
|
574 |
void removeWebDavNonce(WebDavNonce lock); |
|
575 |
|
|
576 |
/** |
|
577 |
* @param tokenId |
|
578 |
* @return |
|
579 |
*/ |
|
580 |
WebDavNonce getWebDavNonce(String tokenId); |
|
563 | 581 |
|
564 | 582 |
} |
b/src/gr/ebs/gss/server/ejb/GSSDAOBean.java | ||
---|---|---|
26 | 26 |
import gr.ebs.gss.server.domain.FileUploadStatus; |
27 | 27 |
import gr.ebs.gss.server.domain.Folder; |
28 | 28 |
import gr.ebs.gss.server.domain.Group; |
29 |
import gr.ebs.gss.server.domain.GssLock;
|
|
29 |
import gr.ebs.gss.server.domain.FileLock;
|
|
30 | 30 |
import gr.ebs.gss.server.domain.Invitation; |
31 | 31 |
import gr.ebs.gss.server.domain.Nonce; |
32 | 32 |
import gr.ebs.gss.server.domain.User; |
33 | 33 |
import gr.ebs.gss.server.domain.UserClass; |
34 | 34 |
import gr.ebs.gss.server.domain.UserLogin; |
35 |
import gr.ebs.gss.server.domain.WebDavNonce; |
|
35 | 36 |
|
36 | 37 |
import java.math.BigInteger; |
37 | 38 |
import java.util.ArrayList; |
... | ... | |
809 | 810 |
|
810 | 811 |
/** WEBDAV LOCK API **/ |
811 | 812 |
@Override |
812 |
public GssLock getLockById(String id) {
|
|
813 |
return manager.find(GssLock.class, id);
|
|
813 |
public FileLock getLockById(String id) {
|
|
814 |
return manager.find(FileLock.class, id);
|
|
814 | 815 |
} |
815 | 816 |
|
816 | 817 |
@Override |
817 |
public GssLock getLockByToken(String tokenId) {
|
|
818 |
return (GssLock) manager.createQuery("select c from GssLock c where c.tokenId=:tokenId").setParameter("tokenId", tokenId).getSingleResult();
|
|
818 |
public FileLock getLockByToken(String tokenId) {
|
|
819 |
return (FileLock) manager.createQuery("select c from GssLock c where c.tokenId=:tokenId").setParameter("tokenId", tokenId).getSingleResult();
|
|
819 | 820 |
} |
820 | 821 |
|
821 | 822 |
@Override |
822 |
public void removeLock(GssLock lock) {
|
|
823 |
public void removeLock(FileLock lock) {
|
|
823 | 824 |
lock =getLockById(lock.getId()); |
824 | 825 |
if(lock!=null) |
825 | 826 |
manager.remove(lock); |
826 | 827 |
} |
827 | 828 |
|
828 | 829 |
@Override |
829 |
public GssLock saveOrUpdateLock(GssLock lock) {
|
|
830 |
public FileLock saveOrUpdateLock(FileLock lock) {
|
|
830 | 831 |
if(getLockById(lock.getId())!=null) |
831 | 832 |
manager.merge(lock); |
832 | 833 |
else |
... | ... | |
834 | 835 |
manager.flush(); |
835 | 836 |
return lock; |
836 | 837 |
} |
838 |
|
|
839 |
@Override |
|
840 |
public WebDavNonce getWebDavNonce(String tokenId) { |
|
841 |
return manager.find(WebDavNonce.class, tokenId); |
|
842 |
} |
|
843 |
|
|
844 |
@Override |
|
845 |
public void removeWebDavNonce(WebDavNonce nonce) { |
|
846 |
nonce =getWebDavNonce(nonce.getId()); |
|
847 |
if(nonce!=null) |
|
848 |
manager.remove(nonce); |
|
849 |
} |
|
850 |
|
|
851 |
@Override |
|
852 |
public WebDavNonce saveOrUpdateWebDavNonce(WebDavNonce nonce) { |
|
853 |
if(getWebDavNonce(nonce.getId())!=null) |
|
854 |
manager.merge(nonce); |
|
855 |
else |
|
856 |
manager.persist(nonce); |
|
857 |
manager.flush(); |
|
858 |
return nonce; |
|
859 |
} |
|
837 | 860 |
} |
b/src/gr/ebs/gss/server/webdav/milton/GssLockManager.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
import static gr.ebs.gss.server.configuration.GSSConfigurationFactory.getConfiguration; |
24 | 24 |
import gr.ebs.gss.client.exceptions.RpcException; |
25 |
import gr.ebs.gss.server.domain.GssLock;
|
|
25 |
import gr.ebs.gss.server.domain.FileLock;
|
|
26 | 26 |
import gr.ebs.gss.server.ejb.ExternalAPI; |
27 | 27 |
|
28 | 28 |
|
... | ... | |
71 | 71 |
} |
72 | 72 |
|
73 | 73 |
LockToken newToken = new LockToken( UUID.randomUUID().toString(), lockInfo, timeout ); |
74 |
GssLock newLock = new GssLock( resource.getUniqueId(), newToken);
|
|
74 |
FileLock newLock = new FileLock( resource.getUniqueId(), newToken);
|
|
75 | 75 |
getService().saveOrUpdateLock(newLock); |
76 | 76 |
return LockResult.success( newToken ); |
77 | 77 |
} |
78 | 78 |
|
79 | 79 |
public synchronized LockResult refresh( String tokenId, LockableResource resource ) { |
80 |
GssLock curLock = getService().getLockByToken(tokenId);
|
|
80 |
FileLock curLock = getService().getLockByToken(tokenId);
|
|
81 | 81 |
if( curLock == null ) { |
82 | 82 |
log.debug( "can't refresh because no lock"); |
83 | 83 |
return LockResult.failed( LockResult.FailureReason.PRECONDITION_FAILED ); |
... | ... | |
102 | 102 |
} |
103 | 103 |
|
104 | 104 |
private LockToken currentLock( GssResource resource ) { |
105 |
GssLock curLock = getService().getLockById(resource.getUniqueId());
|
|
105 |
FileLock curLock = getService().getLockById(resource.getUniqueId());
|
|
106 | 106 |
if( curLock == null ) return null; |
107 | 107 |
LockToken token = curLock.toToken(); |
108 | 108 |
if( token.isExpired() ) { |
... | ... | |
115 | 115 |
|
116 | 116 |
private void removeLock( LockToken token ) { |
117 | 117 |
log.debug( "removeLock: " + token.tokenId ); |
118 |
GssLock currentLock = getService().getLockByToken(token.tokenId);
|
|
118 |
FileLock currentLock = getService().getLockByToken(token.tokenId);
|
|
119 | 119 |
if( currentLock != null ) { |
120 | 120 |
getService().removeLock(currentLock); |
121 | 121 |
} else { |
... | ... | |
125 | 125 |
|
126 | 126 |
public LockToken getCurrentToken( LockableResource r ) { |
127 | 127 |
GssResource resource = (GssResource) r; |
128 |
GssLock lock = getService().getLockById( resource.getUniqueId() );
|
|
128 |
FileLock lock = getService().getLockById( resource.getUniqueId() );
|
|
129 | 129 |
if( lock == null ) return null; |
130 | 130 |
LockToken token = new LockToken(); |
131 | 131 |
token.info = new LockInfo( LockInfo.LockScope.EXCLUSIVE, LockInfo.LockType.WRITE, lock.lockedByUser, LockInfo.LockDepth.ZERO ); |
b/src/gr/ebs/gss/server/webdav/milton/GssMiltonServlet.java | ||
---|---|---|
31 | 31 |
import com.bradmcevoy.http.MiltonServlet; |
32 | 32 |
import com.bradmcevoy.http.ServletHttpManager; |
33 | 33 |
import com.bradmcevoy.http.http11.auth.PreAuthenticationFilter; |
34 |
import com.bradmcevoy.http.http11.auth.SimpleMemoryNonceProvider; |
|
35 | 34 |
import com.bradmcevoy.http.webdav.DefaultWebDavResponseHandler; |
36 | 35 |
import com.ettrema.console.ConsoleResourceFactory; |
37 | 36 |
|
... | ... | |
48 | 47 |
try { |
49 | 48 |
this.config = config; |
50 | 49 |
GssLockManager lockManager = new GssLockManager(); |
51 |
SimpleMemoryNonceProvider nonce = new SimpleMemoryNonceProvider( 60*60*24 ); |
|
50 |
//SimpleMemoryNonceProvider nonce = new SimpleMemoryNonceProvider( 60*60*24 ); |
|
51 |
GssNonceProvider nonce = new GssNonceProvider( 60*60*24 ); |
|
52 | 52 |
GssSecurityManager securityManager = new GssSecurityManager("Pithos WebDAV"); |
53 | 53 |
AuthenticationService authService = new AuthenticationService(nonce); |
54 | 54 |
authService.setDisableBasic(true); |
... | ... | |
60 | 60 |
resourceFactory.setLockManager(lockManager); |
61 | 61 |
resourceFactory.setMaxAgeSeconds(3600l); |
62 | 62 |
resourceFactory.setContextPath("webdav"); |
63 |
PreAuthenticationFilter filter = new PreAuthenticationFilter(compressHandler, securityManager,nonce); |
|
63 |
//PreAuthenticationFilter filter = new PreAuthenticationFilter(compressHandler, securityManager,nonce);
|
|
64 | 64 |
ConsoleResourceFactory consoleResourceFactory = new ConsoleResourceFactory(resourceFactory, "/console", "/webdav", Arrays.asList(new com.ettrema.console.LsFactory(), |
65 | 65 |
new com.ettrema.console.CdFactory(), |
66 | 66 |
new com.ettrema.console.RmFactory(), |
b/src/gr/ebs/gss/server/webdav/milton/GssNonceProvider.java | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2011 Electronic Business Systems Ltd. |
|
3 |
* |
|
4 |
* This file is part of GSS. |
|
5 |
* |
|
6 |
* GSS is free software: you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation, either version 3 of the License, or |
|
9 |
* (at your option) any later version. |
|
10 |
* |
|
11 |
* GSS is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with GSS. If not, see <http://www.gnu.org/licenses/>. |
|
18 |
*/ |
|
19 |
package gr.ebs.gss.server.webdav.milton; |
|
20 |
|
|
21 |
import static gr.ebs.gss.server.configuration.GSSConfigurationFactory.getConfiguration; |
|
22 |
import gr.ebs.gss.client.exceptions.RpcException; |
|
23 |
import gr.ebs.gss.server.domain.WebDavNonce; |
|
24 |
import gr.ebs.gss.server.ejb.ExternalAPI; |
|
25 |
|
|
26 |
import java.util.Date; |
|
27 |
import java.util.Map; |
|
28 |
import java.util.UUID; |
|
29 |
import java.util.concurrent.ConcurrentHashMap; |
|
30 |
|
|
31 |
import javax.naming.Context; |
|
32 |
import javax.naming.InitialContext; |
|
33 |
import javax.naming.NamingException; |
|
34 |
import javax.rmi.PortableRemoteObject; |
|
35 |
|
|
36 |
import org.slf4j.Logger; |
|
37 |
import org.slf4j.LoggerFactory; |
|
38 |
|
|
39 |
import com.bradmcevoy.http.Request; |
|
40 |
import com.bradmcevoy.http.Resource; |
|
41 |
import com.bradmcevoy.http.http11.auth.ExpiredNonceRemover; |
|
42 |
import com.bradmcevoy.http.http11.auth.Nonce; |
|
43 |
import com.bradmcevoy.http.http11.auth.NonceProvider; |
|
44 |
import com.bradmcevoy.http.http11.auth.SimpleMemoryNonceProvider; |
|
45 |
import com.bradmcevoy.http.http11.auth.NonceProvider.NonceValidity; |
|
46 |
|
|
47 |
|
|
48 |
/** |
|
49 |
* @author kman |
|
50 |
* |
|
51 |
*/ |
|
52 |
public class GssNonceProvider implements NonceProvider { |
|
53 |
|
|
54 |
private static final Logger log = LoggerFactory.getLogger( GssNonceProvider.class ); |
|
55 |
private final int nonceValiditySeconds; |
|
56 |
private boolean enableNonceCountChecking; |
|
57 |
public GssNonceProvider( int nonceValiditySeconds ) { |
|
58 |
this.nonceValiditySeconds = nonceValiditySeconds; |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public String createNonce(Resource resource, Request request ) { |
|
63 |
UUID id = UUID.randomUUID(); |
|
64 |
Date now = new Date(); |
|
65 |
Nonce n = new Nonce( id, now ); |
|
66 |
createOrUpdateGssNonce(n); |
|
67 |
return n.getValue().toString(); |
|
68 |
} |
|
69 |
|
|
70 |
@Override |
|
71 |
public NonceValidity getNonceValidity( String nonce, Long nc ) { |
|
72 |
log.trace( "getNonceValidity: " + nonce ); |
|
73 |
UUID value = null; |
|
74 |
try { |
|
75 |
value = UUID.fromString( nonce ); |
|
76 |
} catch( Exception e ) { |
|
77 |
log.warn( "couldnt parse nonce" ); |
|
78 |
return NonceValidity.INVALID; |
|
79 |
} |
|
80 |
Nonce n = getNonce( nonce ); |
|
81 |
if( n == null ) { |
|
82 |
log.debug( "not found"); |
|
83 |
return NonceValidity.INVALID; |
|
84 |
} else { |
|
85 |
if( isExpired( n.getIssued() ) ) { |
|
86 |
log.debug( "nonce has expired" ); |
|
87 |
return NonceValidity.EXPIRED; |
|
88 |
} else { |
|
89 |
if( nc == null ) { |
|
90 |
log.trace( "nonce ok" ); |
|
91 |
return NonceValidity.OK; |
|
92 |
} else { |
|
93 |
if( enableNonceCountChecking && nc <= n.getNonceCount() ) { |
|
94 |
log.warn( "nonce-count was not greater then previous, possible replay attack. new: " + nc + " old:" + n.getNonceCount() ); |
|
95 |
return NonceValidity.INVALID; |
|
96 |
} else { |
|
97 |
log.trace( "nonce and nonce-count ok" ); |
|
98 |
Nonce newNonce = n.increaseNonceCount( nc ); |
|
99 |
createOrUpdateGssNonce(newNonce); |
|
100 |
return NonceValidity.OK; |
|
101 |
} |
|
102 |
} |
|
103 |
} |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
107 |
private boolean isExpired( Date issued ) { |
|
108 |
long dif = ( System.currentTimeMillis() - issued.getTime() ) / 1000; |
|
109 |
return dif > nonceValiditySeconds; |
|
110 |
} |
|
111 |
|
|
112 |
private void createOrUpdateGssNonce(Nonce nonce){ |
|
113 |
try{ |
|
114 |
WebDavNonce non = getService().getWebDavNonce(nonce.getValue().toString()); |
|
115 |
if(non==null){ |
|
116 |
non = new WebDavNonce(); |
|
117 |
non.setId(nonce.getValue().toString()); |
|
118 |
} |
|
119 |
non.setIssued(nonce.getIssued()); |
|
120 |
non.setNonceCount(nonce.getNonceCount()); |
|
121 |
getService().saveOrUpdateWebDavNonce(non); |
|
122 |
} |
|
123 |
catch(Exception ex){ |
|
124 |
ex.printStackTrace(); |
|
125 |
} |
|
126 |
} |
|
127 |
|
|
128 |
private Nonce getNonce(String id){ |
|
129 |
try{ |
|
130 |
WebDavNonce non = getService().getWebDavNonce(id); |
|
131 |
if(non!=null){ |
|
132 |
Nonce nonce = new Nonce(UUID.fromString(id), non.getIssued()); |
|
133 |
nonce.increaseNonceCount(non.getNonceCount()); |
|
134 |
return nonce; |
|
135 |
} |
|
136 |
} |
|
137 |
catch(Exception ex){ |
|
138 |
ex.printStackTrace(); |
|
139 |
} |
|
140 |
return null; |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* A helper method that retrieves a reference to the ExternalAPI bean and |
|
145 |
* stores it for future use. |
|
146 |
* |
|
147 |
* @return an ExternalAPI instance |
|
148 |
* @throws RpcException in case an error occurs |
|
149 |
*/ |
|
150 |
protected ExternalAPI getService() throws RpcException { |
|
151 |
try { |
|
152 |
final Context ctx = new InitialContext(); |
|
153 |
final Object ref = ctx.lookup(getConfiguration().getString("externalApiPath")); |
|
154 |
return (ExternalAPI) PortableRemoteObject.narrow(ref, ExternalAPI.class); |
|
155 |
} catch (final NamingException e) { |
|
156 |
log.error("Unable to retrieve the ExternalAPI EJB", e); |
|
157 |
throw new RpcException("An error occurred while contacting the naming service"); |
|
158 |
} |
|
159 |
} |
|
160 |
/** |
|
161 |
* IE seems to send nc (nonce count) parameters out of order. To correctly |
|
162 |
* implement checking we need to record which nonces have been sent, and not |
|
163 |
* assume they will be sent in a monotonically increasing sequence. |
|
164 |
* |
|
165 |
* The quick fix here is to disable checking of the nc param, since other |
|
166 |
* common servers seem to do so to. |
|
167 |
* |
|
168 |
* Note that this will allow replay attacks. |
|
169 |
* |
|
170 |
* @return |
|
171 |
*/ |
|
172 |
public boolean isEnableNonceCountChecking() { |
|
173 |
return enableNonceCountChecking; |
|
174 |
} |
|
175 |
|
|
176 |
public void setEnableNonceCountChecking( boolean enableNonceCountChecking ) { |
|
177 |
this.enableNonceCountChecking = enableNonceCountChecking; |
|
178 |
} |
|
179 |
} |
Also available in: Unified diff