Revision 725
Added by bojilova about 23 years ago
MetaCatServlet.java | ||
---|---|---|
96 | 96 |
* action=getdoctypes -- retrieve all doctypes (publicID)<br> |
97 | 97 |
* action=getdtdschema -- retrieve a DTD or Schema file<br> |
98 | 98 |
* action=getdataguide -- retrieve a Data Guide<br> |
99 |
* action=getprincipals -- retrieve a list of principals in XML<br> |
|
99 | 100 |
* datadoc -- data document name (id)<br> |
100 | 101 |
* <p> |
101 | 102 |
* The particular combination of parameters that are valid for each |
... | ... | |
246 | 247 |
// by looking up the current session information for all actions |
247 | 248 |
// other than "login" and "logout" |
248 | 249 |
String username = null; |
250 |
String password = null; |
|
249 | 251 |
String groupname = null; |
250 | 252 |
String sess_id = null; |
251 | 253 |
|
... | ... | |
269 | 271 |
sess.setAttribute("username", username); |
270 | 272 |
} else { |
271 | 273 |
username = (String)sess.getAttribute("username"); |
274 |
password = (String)sess.getAttribute("password"); |
|
272 | 275 |
groupname = (String)sess.getAttribute("groupname"); |
273 | 276 |
try |
274 | 277 |
{ |
... | ... | |
377 | 380 |
} else if (action.equals("getdataguide")) { |
378 | 381 |
PrintWriter out = response.getWriter(); |
379 | 382 |
handleGetDataGuideAction(out, params, response); |
383 |
} else if (action.equals("getprincipals")) { |
|
384 |
PrintWriter out = response.getWriter(); |
|
385 |
handleGetPrincipalsAction(out, username, password); |
|
380 | 386 |
} else if (action.equals("login") || action.equals("logout")) { |
381 | 387 |
} else if (action.equals("protocoltest")) { |
382 | 388 |
String testURL = "metacat://dev.nceas.ucsb.edu/NCEAS.897766.9"; |
... | ... | |
1696 | 1702 |
|
1697 | 1703 |
} |
1698 | 1704 |
|
1705 |
/** |
|
1706 |
* Handle the "getprincipals" action. |
|
1707 |
* Read all principals from authentication scheme in XML format |
|
1708 |
*/ |
|
1709 |
private void handleGetPrincipalsAction(PrintWriter out, String user, |
|
1710 |
String password) { |
|
1711 |
|
|
1712 |
Connection conn = null; |
|
1713 |
|
|
1714 |
try { |
|
1715 |
|
|
1716 |
// get connection from the pool |
|
1717 |
AuthSession auth = new AuthSession(); |
|
1718 |
String principals = auth.getPrincipals(user, password); |
|
1719 |
out.println(principals); |
|
1720 |
|
|
1721 |
} catch (Exception e) { |
|
1722 |
out.println("<?xml version=\"1.0\"?>"); |
|
1723 |
out.println("<error>"); |
|
1724 |
out.println(e.getMessage()); |
|
1725 |
out.println("</error>"); |
|
1726 |
} finally { |
|
1727 |
util.returnConnection(conn); |
|
1728 |
} |
|
1729 |
|
|
1730 |
} |
|
1731 |
|
|
1699 | 1732 |
} |
Also available in: Unified diff
Included back getting the list of users and groups stored in auth scheme
through new action="getprincipals". No extra parameters are needed.
Any logged in users are able to get this information