Mercurial Hosting > luan
comparison src/org/eclipse/jetty/server/Request.java @ 813:f8f7cb485c25
remove UserIdentity
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 08 Sep 2016 22:01:33 -0600 |
parents | 1bedcd0ec275 |
children | 07c82fabc46b |
comparison
equal
deleted
inserted
replaced
812:700317ba03ad | 813:f8f7cb485c25 |
---|---|
207 private String _remoteAddr; | 207 private String _remoteAddr; |
208 private String _remoteHost; | 208 private String _remoteHost; |
209 private Object _requestAttributeListeners; | 209 private Object _requestAttributeListeners; |
210 private String _requestURI; | 210 private String _requestURI; |
211 private String _scheme = URIUtil.HTTP; | 211 private String _scheme = URIUtil.HTTP; |
212 private UserIdentity.Scope _scope; | |
213 private String _serverName; | 212 private String _serverName; |
214 private String _servletPath; | 213 private String _servletPath; |
215 private long _timeStamp; | 214 private long _timeStamp; |
216 private long _dispatchTime; | 215 private long _dispatchTime; |
217 | 216 |
1204 return _context; | 1203 return _context; |
1205 } | 1204 } |
1206 | 1205 |
1207 /* ------------------------------------------------------------ */ | 1206 /* ------------------------------------------------------------ */ |
1208 /* | 1207 /* |
1209 */ | |
1210 public String getServletName() | |
1211 { | |
1212 if (_scope != null) | |
1213 return _scope.getName(); | |
1214 return null; | |
1215 } | |
1216 | |
1217 /* ------------------------------------------------------------ */ | |
1218 /* | |
1219 * @see javax.servlet.http.HttpServletRequest#getServletPath() | 1208 * @see javax.servlet.http.HttpServletRequest#getServletPath() |
1220 */ | 1209 */ |
1221 public String getServletPath() | 1210 public String getServletPath() |
1222 { | 1211 { |
1223 if (_servletPath == null) | 1212 if (_servletPath == null) |
1281 { | 1270 { |
1282 return _uri; | 1271 return _uri; |
1283 } | 1272 } |
1284 | 1273 |
1285 /* ------------------------------------------------------------ */ | 1274 /* ------------------------------------------------------------ */ |
1286 public UserIdentity getUserIdentity() | 1275 /* |
1276 * @see javax.servlet.http.HttpServletRequest#getUserPrincipal() | |
1277 */ | |
1278 public Principal getUserPrincipal() | |
1287 { | 1279 { |
1288 if (_authentication instanceof Authentication.Deferred) | 1280 if (_authentication instanceof Authentication.Deferred) |
1289 setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); | 1281 setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); |
1290 | 1282 |
1291 if (_authentication instanceof Authentication.User) | |
1292 return ((Authentication.User)_authentication).getUserIdentity(); | |
1293 return null; | |
1294 } | |
1295 | |
1296 /* ------------------------------------------------------------ */ | |
1297 /** | |
1298 * @return The resolved user Identity, which may be null if the {@link Authentication} is not {@link Authentication.User} (eg. | |
1299 * {@link Authentication.Deferred}). | |
1300 */ | |
1301 public UserIdentity getResolvedUserIdentity() | |
1302 { | |
1303 if (_authentication instanceof Authentication.User) | |
1304 return ((Authentication.User)_authentication).getUserIdentity(); | |
1305 return null; | |
1306 } | |
1307 | |
1308 /* ------------------------------------------------------------ */ | |
1309 public UserIdentity.Scope getUserIdentityScope() | |
1310 { | |
1311 return _scope; | |
1312 } | |
1313 | |
1314 /* ------------------------------------------------------------ */ | |
1315 /* | |
1316 * @see javax.servlet.http.HttpServletRequest#getUserPrincipal() | |
1317 */ | |
1318 public Principal getUserPrincipal() | |
1319 { | |
1320 if (_authentication instanceof Authentication.Deferred) | |
1321 setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); | |
1322 | |
1323 if (_authentication instanceof Authentication.User) | |
1324 { | |
1325 UserIdentity user = ((Authentication.User)_authentication).getUserIdentity(); | |
1326 return user.getUserPrincipal(); | |
1327 } | |
1328 | |
1329 return null; | 1283 return null; |
1330 } | 1284 } |
1331 | 1285 |
1332 /* ------------------------------------------------------------ */ | 1286 /* ------------------------------------------------------------ */ |
1333 /** | 1287 /** |
1409 */ | 1363 */ |
1410 public boolean isUserInRole(String role) | 1364 public boolean isUserInRole(String role) |
1411 { | 1365 { |
1412 if (_authentication instanceof Authentication.Deferred) | 1366 if (_authentication instanceof Authentication.Deferred) |
1413 setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); | 1367 setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); |
1414 | |
1415 if (_authentication instanceof Authentication.User) | |
1416 return ((Authentication.User)_authentication).isUserInRole(_scope,role); | |
1417 return false; | 1368 return false; |
1418 } | 1369 } |
1419 | 1370 |
1420 /* ------------------------------------------------------------ */ | 1371 /* ------------------------------------------------------------ */ |
1421 public HttpSession recoverNewSession(Object key) | 1372 public HttpSession recoverNewSession(Object key) |
1461 _port = 0; | 1412 _port = 0; |
1462 _protocol = HttpVersions.HTTP_1_1; | 1413 _protocol = HttpVersions.HTTP_1_1; |
1463 _queryEncoding = null; | 1414 _queryEncoding = null; |
1464 _queryString = null; | 1415 _queryString = null; |
1465 _requestURI = null; | 1416 _requestURI = null; |
1466 _scope = null; | |
1467 _scheme = URIUtil.HTTP; | 1417 _scheme = URIUtil.HTTP; |
1468 _servletPath = null; | 1418 _servletPath = null; |
1469 _timeStamp = 0; | 1419 _timeStamp = 0; |
1470 _timeStampBuffer = null; | 1420 _timeStampBuffer = null; |
1471 _uri = null; | 1421 _uri = null; |
1881 * The uri to set. | 1831 * The uri to set. |
1882 */ | 1832 */ |
1883 public void setUri(HttpURI uri) | 1833 public void setUri(HttpURI uri) |
1884 { | 1834 { |
1885 _uri = uri; | 1835 _uri = uri; |
1886 } | |
1887 | |
1888 /* ------------------------------------------------------------ */ | |
1889 public void setUserIdentityScope(UserIdentity.Scope scope) | |
1890 { | |
1891 _scope = scope; | |
1892 } | 1836 } |
1893 | 1837 |
1894 /* ------------------------------------------------------------ */ | 1838 /* ------------------------------------------------------------ */ |
1895 /** | 1839 /** |
1896 * Set timetstamp of request dispatch | 1840 * Set timetstamp of request dispatch |