<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Junky's IT Notebook

    統計

    留言簿(8)

    積分與排名

    WebSphere Studio

    閱讀排行榜

    評論排行榜

    liferay portal 4.2.1 配置sso+cas

    按照官方文檔配置:

    Introduction
    The following are a set of instructions for integrating Liferay Portal with CAS Server to setup single sign on (SSO) between Liferay and an existing web application.

    [edit]Setting up CAS server
    We will begin with setting up JA-SIG CAS server on Tomcat 5.x.x.

    Download cas-server WAR from Liferay's download page or the whole distribution from here and drop the cas-web.war file into Tomcat's webapps dir. In a production environment The CAS server should really run on its own tomcat instance but for testing purposes we'll drop it in the same instance as our Liferay portal.

    We'll need to edit the server.xml file in tomcat and uncomment the SSL section to open up port 8443.

    xml 代碼

     

    1. <Connector port="8443" maxHttpHeaderSize="8192"  

    2. maxThreads="150" minSpareThreads="25" maxSpareThreads="75"  

    3. enableLookups="false" disableUploadTimeout="true"  

    4. acceptCount="100" scheme="https" secure="true"  

    5. clientAuth="false" sslProtocol="TLS" />  


    [edit]Setting up the CAS client
    Next we need to download the Yale CAS client from here. Get cas-client-2.0.11. Place the casclient.jar in ROOT/web-inf/lib of the Liferay install.

    [edit]Generate the SSL cert with Java keytool
    Now that we have everything we need, it's time to generate an SSL cert for our CAS server. Instructions and more information on SSL certs can be found here(http://www.ja-sig.org/products/cas/downloads/index.html)

    (我下載的就是這個版本,3.0應該也是可以的,我沒有測試。)

    But I found some typos and errors on that page. So following the instructions below should get you what you need.

    In any directory ( I use my root ) enter the command:

    keytool -genkey -alias tomcat -keypass changeit -keyalg RSA

    Answer the questions: (note that your firstname and lastname MUST be hostname of your server and cannot be a IP address; this is very important as an IP address will fail client hostname verification even if it is correct)

    Enter keystore password:  changeit
    What is your first and last name?
    [Unknown]:  localhost
    What is the name of your organizational unit?
    [Unknown]:
    What is the name of your organization?
    [Unknown]:
    What is the name of your City or Locality?
    [Unknown]:
    What is the name of your State or Province?
    [Unknown]:
    What is the two-letter country code for this unit?
    [Unknown]:
    Is CN=localhost, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
    [no]: yes

    (這點需要注意,都需要添上,否則不能通過,不會生成.keystore目錄;下面的文件名隨便輸入一個)
    Then enter the command:

    keytool -export -alias tomcat -keypass changeit -file %FILE_NAME%
    I use server.cert for %FILE_NAME%. This command exports the cert you generated from your personal keystore (In windows your personal keystore is in C:\Documents and Settings\\.keystore)

    Finally import the cert into Java's keystore with this command. Tomcat uses the keystore in your JRE (%JAVA_HOME%/jre/lib/security/cacerts)

    keytool -import -alias tomcat -file %FILE_NAME% -keypass changeit -keystore %JAVA_HOME%/jre/lib/security/cacerts
    Startup the CAS server

    Now you are ready to startup your CAS server. Simply startup Tomcat and access CAS with https://localhost:8443/cas You should see the CAS login screen and no errors in your catalina logs.

    [edit]Setting up Liferay Portal
    [edit]web.xml
    Note: If you are using Liferay 4.2, this filter is already defined. All you have to do is modify the URL parameters, if your CAS server is at a different location.

    It's time to move on to configuring Liferay. In the web.xml file you will need to add a new filter and its mapping directly above the first existing auto login filter mapping. This new filter we just added will redirect all login attempts to the CAS server. If your hostname is different you can modify the init-params accordingly. 
     

    xml 代碼

     

    1. <filter>    

    2.    <filter-name>CAS Filter</filter-name>    

    3.    <filter-class>edu.yale.its.tp.cas.client.filter.CASFilter</filter-class>    

    4.    <init-param>    

    5.       <param-name>edu.yale.its.tp.cas.client.filter.loginUrl</param-name>    

    6.       <param-value>https://localhost:8443/cas-web/login</param-value>    

    7.    </init-param>    

    8.    <init-param>    

    9.       <param-name>edu.yale.its.tp.cas.client.filter.validateUrl</param-name>    

    10.       <param-value>https://localhost:8443/cas-web/proxyValidate</param-value>    

    11.    </init-param>    

    12.    <init-param>    

    13.       <param-name>edu.yale.its.tp.cas.client.filter.serviceUrl</param-name>    

    14.       <param-value>http://localhost:8080/c/portal/login</param-value>    

    15.    </init-param>    

    16. </filter>  



    If you use a ...serviceUrl param like above, after logging in with CAS, the browser will be redirected back to that serviceUrl. However, you can change it to the following and it will redirect back to the full URL that was originally requested. This allows you to have a deep link (e.g. to a certain layout with parameters for a portlet even) that is preserved through the CAS login process:

    xml 代碼

     

    1.    <init-param>    

    2.       <param-name>edu.yale.its.tp.cas.client.filter.serverName</param-name>    

    3.       <param-value>localhost:8080</param-value>    

    4.    </init-param>    

    5.   

    6. <filter-mapping>    

    7.    <filter-name>CAS Filter</filter-name>    

    8.    <url-pattern>/c/portal/login</url-pattern>    

    9. </filter-mapping>  

    Then add the following to the rest of the auto login filters

    xml 代碼

     

    1. <filter-mapping>    

    2.    <filter-name>Auto Login Filter</filter-name>    

    3.    <url-pattern>/c/portal/login</url-pattern>    

    4.    <dispatcher>FORWARD</dispatcher>    

    5.    <dispatcher>INCLUDE</dispatcher>    

    6.    <dispatcher>REQUEST</dispatcher>    

    7. </filter-mapping>  



    [edit]system-ext.properties
    Note: this is only needed in Liferay 4.2

    Set the com.liferay.filters.sso.cas.CASFilter setting to true.

    ( system-ext.properties這個文件不存在,新建一個\ROOT\WEB-INF\classes\system-ext.properties,然后填入該內容)

    Place the following in system-ext.properties:

       #
       # The CAS filter will redirect the user to the CAS login page for SSO. See
       # http://www.ja-sig.org/products/cas for more information.
       #
       com.liferay.filters.sso.cas.CASFilter=true

    (portal-ext.properties 該文件存在,僅僅添加內容即可)
    [edit]portal-ext.properties
    Put this in portal-ext.properties.

    ##
    ## Auto Login
    ##
    #
    # Input a list of comma delimited class names that implement
    # com.liferay.portal.security.auth.AutoLogin. These classes will run in
    # consecutive order for all unauthenticated users until one of them return a
    # valid user id and password combination. If no valid combination is
    # returned, then the request continues to process normally. If a valid
    # combination is returned, then the portal will automatically login that
    # user with the returned user id and password combination.
    #
    # For example, com.liferay.portal.security.auth.BasicAutoLogin reads from a
    # cookie to automatically log in a user who previously logged in while
    # checking on the "Remember Me" box.
    #
    # This interface allows deployers to easily configure the portal to work
    # with other SSO servers. See com.liferay.portal.security.auth.CASAutoLogin
    # for an example of how to configure the portal with Yale's SSO server.
    #
    #auto.login.hooks=com.liferay.portal.security.auth.BasicAutoLogin
    auto.login.hooks=com.liferay.portal.security.auth.BasicAutoLogin,com.liferay.portal.security.auth.CASAutoLogin
    Comment the first auto.login.hooks property and uncomment the second to add CASAutoLogin to the list of AutoLogin implementations.

    [edit]Startup Liferay and Test
    Startup the portal and when the homepage loads up hit the login link. If all goes well you should be redirected to the CAS server's login screen. Login to CAS with liferay.com.1 as your username and liferay.com.1 as your password. You should now be logged into the portal.

    The current auth scheme for CAS is quite simple but in production an auth scheme which taps into an LDAP repository or some other auth service will be required.

    [edit]Troubleshooting
    If you created a cert with the %FILE_NAME%, you'll probably run into problems. Here are 2 commands to delete the tomcat alias from the keystore so you can start fresh:

    keytool -delete -alias tomcat -keystore %JAVA_HOME%/jre/lib/security/cacerts
    keytool -delete -alias tomcat -file server.cert
    You may not be able to get https://localhost:8443/cas up and running after the cert key generation. If so, skip the test and try it after you've finished all the steps. If you can't login at that point, you've probably generated your cert incorrectly.
    I've had problems with certs on IE7, make sure you try it out on Firefox and Opera.
    [edit]Lifecast
    CAS Setup - Integrate Liferay Portal with a CAS server to access multiple applications with a single sign on.

    Retrieved from "http://wiki.liferay.com/index.php/Single_SignOn_-_Integrating_Liferay_With_CAS_Server"
    Category: Customization

    posted on 2007-05-22 13:48 junky 閱讀(836) 評論(0)  編輯  收藏 所屬分類: security

    主站蜘蛛池模板: 无码精品A∨在线观看免费| 最近免费中文字幕大全高清大全1| 中文字幕无码播放免费| 亚洲无删减国产精品一区| a级在线免费观看| 亚洲AV无码精品无码麻豆| 久久成人a毛片免费观看网站| 亚洲成AV人在线观看天堂无码| a毛看片免费观看视频| 亚洲热妇无码AV在线播放| 最好免费观看高清在线 | 色se01短视频永久免费| 亚洲国产成人精品无码一区二区| 久久久久久精品成人免费图片| 亚洲一区免费视频| 成年18网站免费视频网站| 亚洲AV无码专区国产乱码不卡| 国产成人免费全部网站| 一出一进一爽一粗一大视频免费的| 亚洲午夜精品第一区二区8050| a级毛片在线免费| 亚洲男女性高爱潮网站| 夜夜嘿视频免费看| 西西人体大胆免费视频| 亚洲精品高清无码视频| 国产成人精品免费视频动漫| 亚洲国产午夜精品理论片在线播放| 免费v片视频在线观看视频| 成全视成人免费观看在线看| 亚洲av永久无码制服河南实里| 亚洲啪啪免费视频| 另类专区另类专区亚洲| 亚洲国产精品一区二区成人片国内| 中文字幕无码播放免费| 永久免费精品影视网站| 色播亚洲视频在线观看| 国产在线观看免费不卡| 人妻在线日韩免费视频| 亚洲日本一线产区和二线| 亚洲一区二区三区无码中文字幕| 免费H网站在线观看的|