IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JSF Java Discussion :

CAS Server et JSF


Sujet :

JSF Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    103
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2006
    Messages : 103
    Par défaut CAS Server et JSF
    Bonjour,

    J'utilise CAS server pour l'authentification. J'ai donc un war déploier sur mon Tomcat qui affiche la première page de login.
    J'aimerais si c'est possible pouvoir utiliser dans cette page de login les différents tag de JSF (f:view, h:...).

    Voici mon fichier xml actuelle (fonctionne bien mais je ne peut pas utiliser les tag JSF) :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    	version="2.4">
    	<display-name>Central Authentication System (CAS) 3.0</display-name>
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			/WEB-INF/applicationContext.xml,
    			/WEB-INF/deployerConfigContext.xml
    		</param-value>
    	</context-param>
     
    	<!-- 
    		place this into the contextConfigLocation to enable
    		service restrictions.
    		/WEB-INF/approvedServices.xml,
     
    		place this into the contextConfigLocation to enable remote services
    		/WEB-INF/remoteServices.xml,
    		classpath:org/codehaus/xfire/spring/xfire.xml
     
    		place this into the contextConfigLocation to enable the event publishing
    		/WEB-INF/auditTrailContext.xml,
    	-->
     
    	<!--
    		- Location of the Log4J config file, for initialization and refresh checks.
    		- Applied by Log4jConfigListener.
    	-->
    	<context-param>
    		<param-name>log4jConfigLocation</param-name>
    		<param-value>classpath:log4j.properties</param-value>
    	</context-param>
     
    	<context-param>
    		<param-name>log4jExposeWebAppRoot</param-name>
    		<param-value>false</param-value>
    	</context-param>
     
    	<!--
    		- Configures Log4J for this web app.
    		- As this context specifies a context-param "log4jConfigLocation", its file path
    		- is used to load the Log4J configuration, including periodic refresh checks.
    		-
    		- Would fall back to default Log4J initialization (non-refreshing) if no special
    		- context-params are given.
    		-
    		- Exports a "web app root key", i.e. a system property that specifies the root
    		- directory of this web app, for usage in log file paths.
    		- This web app specifies "cas.root" (see log4j.properties file).
    	-->
    	<!-- Leave the listener commented-out if using JBoss -->
    	<listener>
    		<listener-class>
    			org.springframework.web.util.Log4jConfigListener
    		</listener-class>
    	</listener>
     
    	<!--
    		- Loads the CAS ApplicationContext.  
    		- The deployer choice here is how to handle Throwables thrown by Spring's 
    		- ContextLoaderListener.  The Spring ContextLoaderListener will throw an exception when the
    		- application context cannot be loaded, say because the bean XML files are not valid XML or do not
    		- refer to real classes and properties or because a bean configured via Spring throws an exception
    		- at construction, property setting, or on an afterPropertiesSet() lifecycle method.
    		-
    		- If you'd like these errors to be fatal and prevent the CAS servlet context from loading at all,
    		- use org.springframework.web.context.ContextLoaderListener.
    		-
    		- If you'd like these errors to result in all requests for CAS getting a "CAS is Unavailable" response, 
    		- use org.jasig.cas.web.init.SafeContextLoaderListener.
    		- for all requests.
    	-->
    	<listener>
    		<listener-class>
    			org.jasig.cas.web.init.SafeContextLoaderListener
    		</listener-class>
    	</listener>
     
    	<!--
    		- This is the Spring dispatcher servlet which delegates all requests to the 
    		- Spring WebMVC controllers as configured in cas-servlet.xml.
    		-   
    		- The choice made above about how to handle a broken ApplicationContext at 
    		- context initialization applies here as well, sicne this servlet is load-on-startup.
    		-
    		- If you'd like these errors to be fatal and prevent the CAS servlet from loading at all,
    		- use org.springframework.web.servlet.DispatcherServlet.
    		-
    		- If you'd like these errors to result in all requests for CAS getting a "CAS is Unavailable" response, 
    		- use org.jasig.cas.web.init.SafeDispatcherServlet for all requests serviced by this servlet.
    	-->
    	<servlet>
    		<servlet-name>cas</servlet-name>
    		<servlet-class>
    			org.jasig.cas.web.init.SafeDispatcherServlet
    		</servlet-class>
    		<init-param>
    			<param-name>publishContext</param-name>
    			<param-value>false</param-value>
    		</init-param>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
     
    	<servlet-mapping>
    		<servlet-name>cas</servlet-name>
    		<url-pattern>/login</url-pattern>
    	</servlet-mapping>
     
    	<servlet-mapping>
    		<servlet-name>cas</servlet-name>
    		<url-pattern>/logout</url-pattern>
    	</servlet-mapping>
     
    	<servlet-mapping>
    		<servlet-name>cas</servlet-name>
    		<url-pattern>/validate</url-pattern>
    	</servlet-mapping>
     
    	<servlet-mapping>
    		<servlet-name>cas</servlet-name>
    		<url-pattern>/serviceValidate</url-pattern>
    	</servlet-mapping>
     
    	<servlet-mapping>
    		<servlet-name>cas</servlet-name>
    		<url-pattern>/proxy</url-pattern>
    	</servlet-mapping>
     
    	<servlet-mapping>
    		<servlet-name>cas</servlet-name>
    		<url-pattern>/proxyValidate</url-pattern>
    	</servlet-mapping>
     
    	<servlet-mapping>
    		<servlet-name>cas</servlet-name>
    		<url-pattern>/CentralAuthenticationService</url-pattern>
    	</servlet-mapping>
     
    	<session-config>
    		<!-- Default to 5 minute session timeouts -->
    		<session-timeout>5</session-timeout>
    	</session-config>
     
    	<error-page>
    		<exception-type>org.springframework.context.ApplicationContextException</exception-type>
    		<location>/WEB-INF/view/jsp/brokenContext.jsp</location>
    	</error-page>
     
    	<error-page>
    		<exception-type>java.lang.Exception</exception-type>
    		<location>/WEB-INF/view/jsp/errors.jsp</location>
    	</error-page>
     
    	<error-page>
    		<error-code>404</error-code>
    		<location>/</location>
    	</error-page>
    </web-app>
    J'aimerais savoir que dois je rajouter dans mon fichier xml pour pouvoir utiliser JSF.
    Faut il ajouter les même balise que dans une applique JSF normale :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <context-param>
            <param-name>javax.faces.CONFIG_FILES</param-name> 
            <param-value>/WEB-INF/faces-config.xml</param-value> 
        </context-param>
        <context-param>
            <description>Switch off caching. You can remove this parameter or comment it out when this app goes into production.</description>
            <param-name>jmaki-usecache</param-name>
            <param-value>false</param-value>
        </context-param>
        <context-param>
            <param-name>com.sun.faces.verifyObjects</param-name>
            <param-value>false</param-value>
        </context-param>
        <context-param>
            <param-name>com.sun.faces.validateXml</param-name>
            <param-value>true</param-value>
        </context-param>
        <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>client</param-value>
        </context-param>
        <servlet>
            <servlet-name>XmlHttpProxy</servlet-name>
            <servlet-class>jmaki.xhp.XmlHttpProxyServlet</servlet-class>
        </servlet>
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>XmlHttpProxy</servlet-name>
            <url-pattern>/xhp</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>*.faces</url-pattern>
        </servlet-mapping>
     
        <!-- AJAX4JSF FILTER -->
        <filter>
            <display-name>Ajax4jsf Filter</display-name>
            <filter-name>ajax4jsf</filter-name>
            <filter-class>org.ajax4jsf.Filter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>ajax4jsf</filter-name>
            <servlet-name>Faces Servlet</servlet-name>
            <dispatcher>REQUEST</dispatcher>
            <dispatcher>FORWARD</dispatcher>
            <dispatcher>INCLUDE</dispatcher>
        </filter-mapping>
     
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>forwardToJSF.jsp</welcome-file>
        </welcome-file-list>
        <error-page>
            <exception-type>java.lang.Exception</exception-type>
            <location>/Error.jsp</location>
        </error-page>
        </web-app>
    Merci

    Bonne soirée

  2. #2
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    je suis pas sur que ce soit possible (mais je connais pas CAS). Dans ton cas, il semble que tes formulaires jsp envoient vers ds servlets spécifiques qui traitent les logins. Hors, pour JSF, c'est le servlet JSF qui traite la requête et c'est une "méthode" qui, après validation, effectue le buisness logique. De plus, je crains que tes servlets CAS fassent des redirects vers des jsp, hors pour faire un rendu jsf, il faut passer par la servlet JSF...

Discussions similaires

  1. Intégration de LDAP avec CAS Server
    Par franco9 dans le forum Spring
    Réponses: 1
    Dernier message: 21/01/2014, 13h58
  2. intégration ldap avec cas server
    Par franco9 dans le forum Débuter avec Java
    Réponses: 1
    Dernier message: 07/01/2014, 14h44
  3. CAS Server et MySQL : problème d'attributs
    Par openbsdiste dans le forum Serveurs (Apache, IIS,...)
    Réponses: 1
    Dernier message: 09/02/2011, 17h04
  4. Réponses: 10
    Dernier message: 10/09/2007, 23h35

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo