1、 Jetspeed系统的配置文件在《JetSpeed2 home》/conf/Catalina/localhost下的jetspeed.xml文件中,此文件中定义了JAAS验证的配置及
数据库连接模式(包括连接语句)
2、配置一个居于IFrame的应用:
1、 引入jar包:jetspeed-components-2.0.jar jetspeed-rewriter-2.0.jar jetspeed-web-content-2.0.jar portals-bridges-velocity-1.0.jar portals-gems-2.0.jar (注:可以使用demo应用的lib)
2、 在portal.xml文件中配置一个portlet:
<portlet id="EchoIframe"> <portlet-name>EchoIframe</portlet-name> <display-name>lixin IFrame Portlet</display-name> <description>Prototype of the IFRAME2 portlet</description> <portlet-class>org.apache.jetspeed.portlet.IFrameGenericPortlet</portlet-class> <expiration-cache>-1</expiration-cache> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> </supports> <portlet-preferences> <preference> <name>SRC</name> <value>http://www.sohu.com</value> </preference> <!-- Don't specify a HEIGHT if you want a normal filled out layout because percentage values result in the content not to be displayed on IE6. Specific values are ok though. --> <preference> <name>HEIGHT</name> <value>600</value> </preference> <preference> <name>WIDTH</name> <value>100%</value> </preference> <preference> <name>MAX-HEIGHT</name> <value>800</value> </preference> <preference> <name>MAX-WIDTH</name> <value>100%</value> </preference> <preference> <name>SCROLLING</name> <value>AUTO</value> </preference> </portlet-preferences> <supported-locale>en</supported-locale> <supported-locale>zh</supported-locale> <portlet-info> <title>搜狐网</title> <short-title>搜狐网</short-title> <keywords>iframe,frame,frame2,iframe2</keywords> </portlet-info> </portlet> |
3、 配置对应的.psml文件,如下:
<fragment id="sample-335577" type="layout" name="jetspeed-layouts::VelocityTwoColumns"> <fragment id="sample-3355771" type="portlet" name="sample::EchoIframe"> <property layout="TwoColumns" name="row" value="0" /> <property layout="TwoColumns" name="column" value="0" /> </fragment> <fragment id="sample-3355772" type="portlet" name="sample::EchoPortlet"> <property layout="TwoColumns" name="row" value="0" /> <property layout="TwoColumns" name="column" value="1" /> </fragment> </fragment> |
|
3、
jetspeed2的登陆权限验证完全居于JAAS,其配置文件是在jetspeed应用lib库中的jetspeed-security-<version>.jar中的login.conf文件中定义的,如果想替换成自己的验证模式,可以修改此配置文件,如下:
Jetspeed {
org.apache.jetspeed.security.impl.DefaultLoginModule required;
}; |
请注意,自己加的login.conf配置文件可以放在WEB-INF/classes目录下的任何位置,并且修改WEB-INF/assembly目录下的security-providers.xml文件相应的login.conf文件的新位置。
4、
JAAS的subject主要用来表示一个应用主体对象(用户),此对象有一个或多个用来标识其身份的Principals,如名字(name principal)或者身份证号(SSN principal),principal是用来唯一标识此subject,以区别于其他的subject的。原文如下:
To authorize access to resources, applications first need to authenticate
the source of the request. The JAAS framework defines the term subject
to represent the source of a request. A subject may be any entity, such
as a person or a service. Once the subject is authenticated, a
javax.security.auth.Subject is populated with associated identities, or
Principals. A Subject may have many Principals. For example, a person may
have a name Principal ("John Doe") and a SSN Principal ("123-45-6789"),
which distinguish it from other subjects.
|