Java Doc for PolicyLoader.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » auth » 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 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ecyrd.jspwiki.auth.PolicyLoader

PolicyLoader
final public class PolicyLoader (Code)

Initializes JVM configurations for JAAS and Java 2 security policy. Callers can use the static methods in this class ( PolicyLoader.isJaasConfigured()  and PolicyLoader.isSecurityPolicyConfigured() ) to inquire whether a JAAS login configuration exists, or whether a custom Java security policy is in use. Additional methods allow callers to set the JAAS and security policy configurations to supplied URLs ( PolicyLoader.setJaasConfiguration(URL)  and PolicyLoader.setSecurityPolicy(URL) ).

If either the JAAS configuration and security policy are set using methods in this class, the resulting configuration or policy is global to the JVM. Thus, in a multi-webapp scenario, this means that the first webapp to be loaded by the container wins. Thus, for containers hosting multiple wikis, the administrator will need to manually configure the java.security.policy and java.security.auth.login.config properties. In other words, multi-wiki deployments will always require manual (one-time) configuration.

The security policy-related methods PolicyLoader.isSecurityPolicyConfigured()  and PolicyLoader.setSecurityPolicy(URL) ) assumes that the web container doesn't use a "double-equals" command-line assignment to override the security policy ( e.g. , -Djava.security.policy==jspwiki.policy). Note that Tomcat 4 and higher, when run using the "-security" option, does this.

To interoperate with any container running with a security manager, the container's JVM security policy should include a short set of permission grant similar to the following:

keystore "jspwiki.jks";
  ...
grant signedBy "jspwiki" {
  permission java.security.SecurityPermission, "getPolicy";
  permission java.security.SecurityPermission, "setPolicy";
  permission java.util.PropertyPermission "java.security.auth.login.config", "write";
  permission java.util.PropertyPermission "java.security.policy", "read,write";
  permission javax.security.auth.AuthPermission, "getLoginConfiguration";
  permission javax.security.auth.AuthPermission, "setLoginConfiguration";
};

The signedBy value should match the alias of a digital certificate in the named keystore ( e.g. , jspwiki.jks). If the full path to the keystore is not suppled, it is assumed to be in the same directory as the policy file.


author:
   Andrew Jaquith
since:
   2.3


Field Summary
final protected static  Loggerlog
    


Method Summary
final public static  booleanisJaasConfigured()
    

Returns true if the JAAS login configuration exists. Normally, JAAS is configured by setting the system property java.security.auth.login.config at JVM startup.

This method attempts to perform a highly privileged operation.

final public static  booleanisSecurityPolicyConfigured()
    

Returns true if a custom Java security policy configuration exists.

final public static  voidsetJaasConfiguration(URL url)
     Sets the JAAS login configuration file, overwriting the existing configuration.
final public static  voidsetSecurityPolicy(URL url)
    

Sets the Java security policy, overwriting any custom policy settings.


Field Detail
log
final protected static Logger log(Code)





Method Detail
isJaasConfigured
final public static boolean isJaasConfigured() throws SecurityException(Code)

Returns true if the JAAS login configuration exists. Normally, JAAS is configured by setting the system property java.security.auth.login.config at JVM startup.

This method attempts to perform a highly privileged operation. If the JVM runs with a SecurityManager, the following permission must be granted to the codesource containing this class:

  • permission javax.security.auth.AuthPermission, "getLoginConfiguration"
true ifjavax.security.auth.login.Configuration.getConfigurationis not nullfalse otherwise.
throws:
  SecurityException - if the codesource containing this class posessesinsufficient permmissions when running with a SecurityManager



isSecurityPolicyConfigured
final public static boolean isSecurityPolicyConfigured() throws SecurityException(Code)

Returns true if a custom Java security policy configuration exists. Normally, the Java security policy is configured by setting the system property java.security.policy at JVM startup.

This method attempts to perform a highly privileged operation. If the JVM runs with a SecurityManager, the following permission must be granted to the codesource containing this class:

  • permission java.util.PropertyPermission "java.security.policy", "read"
true if the system propertyjava.security.policy is not nullfalse otherwise.
throws:
  SecurityException - if the codesource containing this class posessesinsufficient permmissions when running with a SecurityManager



setJaasConfiguration
final public static void setJaasConfiguration(URL url) throws SecurityException(Code)
Sets the JAAS login configuration file, overwriting the existing configuration. If the configuration file pointed to by the URL does not exist, a SecurityException is thrown.

This method attempts to perform several highly privileged operations. If the JVM runs with a SecurityManager, the following permissions must be granted to the codesource containing this class:

  • permission java.util.PropertyPermission "java.security.auth.login.config", "write"
  • permission javax.security.auth.AuthPermission, "getLoginConfiguration"
  • permission javax.security.auth.AuthPermission, "setLoginConfiguration"

Parameters:
  url - the URL of the login configuration file. If the URL containsproperties such as ${java.home}, they will beexpanded.
throws:
  SecurityException - if:
  • the supplied URL is null
  • properties cannot be expanded
  • the codesource containing this class does not posessessufficient permmissions when running with a SecurityManager



setSecurityPolicy
final public static void setSecurityPolicy(URL url) throws SecurityException(Code)

Sets the Java security policy, overwriting any custom policy settings. This method sets the value of the system property java.security.policy to the supplied URL, then calls java.security.Policy.setPolicy(java.security.Policy)  with a newly-instantiated instance of sun.security.provider.PolicyFile (the J2SE default implementation). The new Policy, once set, reloads the default system policies enumerated by the policy.url.n entries in JAVA_HOME/lib/security/java.policy, followed by the user-supplied policy file.

This method attempts to perform several highly privileged operations. If the JVM runs with a SecurityManager, the following permissions must be granted to the codesource containing this class:

  • permission java.security.SecurityPermission, "getPolicy"
  • permission java.security.SecurityPermission, "setPolicy"
  • permission java.util.PropertyPermission} "java.security.policy", "write"

Parameters:
  url - the URL of the security policy file. If the URL containsproperties such as ${java.home}, they will beexpanded.
throws:
  SecurityException - if:
  • the supplied URL is null
  • properties cannot be expanded
  • the codesource containing this class does not posessessufficient permmissions when running with a SecurityManager
  • the JVM's current Policy implementation is not of typesun.security.provider.PolicyFile



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.