Java Doc for WebContainerAuthorizer.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » auth » authorize » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Wiki Engine » JSPWiki » com.ecyrd.jspwiki.auth.authorize 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ecyrd.jspwiki.auth.authorize.WebContainerAuthorizer

WebContainerAuthorizer
public class WebContainerAuthorizer implements WebAuthorizer(Code)
Authorizes users by delegating role membership checks to the servlet container. In addition to implementing methods for the Authorizer interface, this class also provides a convenience method WebContainerAuthorizer.isContainerAuthorized() that queries the web application descriptor to determine if the container manages authorization.
author:
   Andrew Jaquith
since:
   2.3

Inner Class :public class LocalEntityResolver implements EntityResolver

Field Summary
final protected static  Loggerlog
    
protected  booleanm_containerAuthorized
     Lazily-initialized boolean flag indicating whether the web container protects JSPWiki resources.
protected  Role[]m_containerRoles
     A lazily-initialized array of Roles that the container knows about.
protected  WikiEnginem_engine
    

Constructor Summary
public  WebContainerAuthorizer()
     Constructs a new instance of the WebContainerAuthorizer class.

Method Summary
public  PrincipalfindRole(String role)
     Looks up and returns a Role Principal matching a given String.
public  Principal[]getRoles()
     Returns an array of role Principals this Authorizer knows about.
protected  Role[]getRoles(Document webxml)
     Protected method that extracts the roles from JSPWiki's web application deployment descriptor.
protected  DocumentgetWebXml()
     Returns an org.jdom.Document representing JSPWiki's web application deployment descriptor.
public  voidinitialize(WikiEngine engine, Properties props)
     Initializes the authorizer for.
public  booleanisConstrained(String url, Role role)
    

Protected method that identifies whether a particular webapp URL is constrained to a particular Role.

public  booleanisContainerAuthorized()
     Returns true if the web container is configured to protect certain JSPWiki resources by requiring authentication.
public  booleanisUserInRole(HttpServletRequest request, Principal role)
     Determines whether a user associated with an HTTP request possesses a particular role.
public  booleanisUserInRole(WikiSession session, Principal role)
     Determines whether the Subject associated with a WikiSession is in a particular role.

Field Detail
log
final protected static Logger log(Code)



m_containerAuthorized
protected boolean m_containerAuthorized(Code)
Lazily-initialized boolean flag indicating whether the web container protects JSPWiki resources.



m_containerRoles
protected Role[] m_containerRoles(Code)
A lazily-initialized array of Roles that the container knows about. These are parsed from JSPWiki's web.xml web application deployment descriptor. If this file cannot be read for any reason, the role list will be empty. This is a hack designed to get around the fact that we have no direct way of querying the web container about which roles it manages.



m_engine
protected WikiEngine m_engine(Code)




Constructor Detail
WebContainerAuthorizer
public WebContainerAuthorizer()(Code)
Constructs a new instance of the WebContainerAuthorizer class.




Method Detail
findRole
public Principal findRole(String role)(Code)
Looks up and returns a Role Principal matching a given String. If the Role does not match one of the container Roles identified during initialization, this method returns null.
Parameters:
  role - the name of the Role to retrieve a Role Principal, or null
See Also:   com.ecyrd.jspwiki.auth.Authorizer.initialize(WikiEngineProperties)



getRoles
public Principal[] getRoles()(Code)
Returns an array of role Principals this Authorizer knows about. This method will return an array of Role objects corresponding to the logical roles enumerated in the web.xml. This method actually returns a defensive copy of an internally stored array. an array of Principals representing the roles



getRoles
protected Role[] getRoles(Document webxml) throws JDOMException(Code)
Protected method that extracts the roles from JSPWiki's web application deployment descriptor. Each Role is constructed by using the String representation of the Role, for example new Role("Administrator").
Parameters:
  webxml - the web application deployment descriptor an array of Role objects
throws:
  JDOMException - if elements cannot be parsed correctly



getWebXml
protected Document getWebXml() throws JDOMException, IOException(Code)
Returns an org.jdom.Document representing JSPWiki's web application deployment descriptor. The document is obtained by calling the servlet context's getResource() method and requesting /WEB-INF/web.xml. For non-servlet applications, this method calls this class' ClassLoader.getResource(java.lang.String) and requesting WEB-INF/web.xml. the descriptor
throws:
  IOException - if the deployment descriptor cannot be found or opened
throws:
  JDOMException - if the deployment descriptor cannot be parsed correctly



initialize
public void initialize(WikiEngine engine, Properties props)(Code)
Initializes the authorizer for.
Parameters:
  engine - the current wiki engine
Parameters:
  props - the wiki engine initialization properties



isConstrained
public boolean isConstrained(String url, Role role) throws JDOMException(Code)

Protected method that identifies whether a particular webapp URL is constrained to a particular Role. The resource is considered constrained if:

  • the web application deployment descriptor contains a security-constraint with a child web-resource-collection/url-pattern element matching the URL, and:
  • this constraint also contains an auth-constraint/role-name element equal to the supplied Role's getName() method. If the supplied Role is Role.ALL, it matches all roles

Parameters:
  url - the web resource
Parameters:
  role - the role true if the resource is constrained to the role,false otherwise
throws:
  JDOMException - if elements cannot be parsed correctly



isContainerAuthorized
public boolean isContainerAuthorized()(Code)
Returns true if the web container is configured to protect certain JSPWiki resources by requiring authentication. Specifically, this method parses JSPWiki's web application descriptor (web.xml) and identifies whether the string representation of com.ecyrd.jspwiki.auth.authorize.Role.AUTHENTICATED is required to access /Delete.jsp and LoginRedirect.jsp. If the administrator has uncommented the large <security-constraint> section of web.xml, this will be true. This is admittedly an indirect way to go about it, but it should be an accurate test for default installations, and also in 99% of customized installs. true if the container protects resources,false otherwise



isUserInRole
public boolean isUserInRole(HttpServletRequest request, Principal role)(Code)
Determines whether a user associated with an HTTP request possesses a particular role. This method simply delegates to javax.servlet.http.HttpServletRequest.isUserInRole(String) by converting the Principal's name to a String.
Parameters:
  request - the HTTP request
Parameters:
  role - the role to check true if the user is considered to be in the role,false otherwise



isUserInRole
public boolean isUserInRole(WikiSession session, Principal role)(Code)
Determines whether the Subject associated with a WikiSession is in a particular role. This method takes two parameters: the WikiSession containing the subject and the desired role ( which may be a Role or a Group). If either parameter is null, this method must return false. This method simply examines the WikiSession subject to see if it possesses the desired Principal. We assume that the method com.ecyrd.jspwiki.auth.AuthenticationManager.login(HttpServletRequest) previously executed at user login time, and that it has injected the role Principals that were in force at login time. This is definitely a hack, but it eliminates the need for WikiSession to keep dangling references to the last WikiContext hanging around, just so we can look up the HttpServletRequest.
Parameters:
  session - the current WikiSession
Parameters:
  role - the role to check true if the user is considered to be in the role,false otherwise
See Also:   com.ecyrd.jspwiki.auth.Authorizer.isUserInRole(com.ecyrd.jspwiki.WikiSessionjava.security.Principal)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.