...
| Bloque de código |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
es.um.atica.security.authentication.AuthenticationMethodNotSupportedException=Authentication method not supported
#------------- Páginas de error ------------
page.error.authauthmethod.title=Authentication method not supported
page.error.authauthmethod.desc=The authentication method used is not allowed for this application, The allowed methods:
page.error.authauthmethod.link.pre=To access the application, you must
page.error.authauthmethod.link=change the authentication method
page.error.authauthmethod.link.post=to one of those allowed. |
messages_es.properties
Añadir al final del fichero las siguientes variables.
| Bloque de código |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
es.um.atica.security.authentication.AuthenticationMethodNotSupportedException=M\u00E9todo de autenticaci\u00F3n no soportado
#------------- Páginas de error ------------
page.error.auth.title=M\u00E9todo de autenticaci\u00F3n no soportado
page.error.auth.desc=El m\u00E9todo de autenticaci\u00F3n utilizado no es v\u00E1lido para esta aplicaci\u00F3n, solamente se permiten los m\u00E9todos:
page.error.auth.link.pre=Para acceder a la aplicaci\u00F3n debe
page.error.auth.link=cambiar de m\u00E9todo de autenticaci\u00F3n
page.error.auth.link.post=a uno de los permitidos. |
pages.xml
Añadir la siguiente regla de navegación:
| Bloque de código |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
<navigation from-action="#{identity.relogByCAS}">
<redirect url="https://${cas.server.url}.um.es/cas/logout?service=https://${cas.application.url}/#{request.contextPath}" />
</navigation> |
Añadir la siguiente excepción:
| Bloque de código |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
<exception class="es.um.atica.apium.security.authentication.AuthenticationMethodNotSupportedException">
<redirect view-id="/error_auth_method.xhtml">
<message severity="error">#{messages['es.um.atica.security.authentication.AuthenticationMethodNotSupportedException']}</message>
</redirect>
</exception> |
ApiumIdentity.java
Modificar esta clase para añadir el método relogByCAS:
page.error.noauth.title=You're not authorized
page.error.noauth.desc=Sorry, you are not authorized to perform this action.
page.error.noauth.link.pre=If you consider that you should have access, contact
page.error.noauth.link=the User Service Center
page.error.noauth.link.post=.
|
messages_es.properties
Añadir al final del fichero las siguientes variables.
| Bloque de código |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
#------------- Páginas de error ------------
page.error.authmethod.title=M\u00E9todo de autenticaci\u00F3n no soportado
page.error.authmethod.desc=El m\u00E9todo de autenticaci\u00F3n utilizado no es v\u00E1lido para esta aplicaci\u00F3n, solamente se permiten los m\u00E9todos:
page.error.authmethod.link.pre=Para acceder a la aplicaci\u00F3n debe
page.error.authmethod.link=cambiar de m\u00E9todo de autenticaci\u00F3n
page.error.authmethod.link.post=a uno de los permitidos.
page.error.noauth.title=Usted no est\u00E1 autorizado
page.error.noauth.desc=Lo siento, usted no est\u00E1 autorizado a realizar esta acci\u00F3n.
page.error.noauth.link.pre=Si considera que deber\u00EDa tener acceso, contacte con
page.error.noauth.link=el Centro de Atenci\u00F3n a Usuarios
page.error.noauth.link.post=.
|
pages.xml
Añadir la siguiente regla de navegación:
| Bloque de código |
|---|
| Bloque de código |
|---|
language | java |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
| package es.um.atica.apium.security.authentication;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Startup;
import
<navigation from-action="#{identity.relogByCAS}">
<redirect url="https://${cas.server.url}.um.es/cas/logout?service=https://${cas.application.url}/#{request.contextPath}" />
</navigation> |
Añadir la siguiente excepción:
| Bloque de código |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
<exception class="es.um.atica.apium.security.authentication.AuthenticationMethodNotSupportedException">
<redirect view-id="/error_auth_method.xhtml">
<message severity="error">#{messages['es.um.atica.security.authentication.AuthenticationMethodNotSupportedException']}</message>
</redirect>
</exception> |
Modificar la excepción para la clase org.jboss.seam.security.AuthorizationException:
| Bloque de código |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
<exception class="annotations.intercept.BypassInterceptors;
import org.jboss.seam.core.Events;
import org.jboss.seam.log.Log;
import security.AuthorizationException">
<redirect view-id="/error_no_auth.xhtml">
<message severity="error">#{messages['org.jboss.seam.security.AuthorizationException']}</message>
</redirect>
</exception> |
ApiumIdentity.java
Modificar esta clase para añadir el método relogByCAS:
| Bloque de código |
|---|
| language | java |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
package es.um.atica.apium.security.authentication;
import log.Logging;
import org.jboss.seam.web.Session;
import es.um.atica.seam.security.UmuIdentity;
@Name( "org.jboss.seam.security.identity" )
@Scope( ScopeType.SESSION )
@Install( precedence = Install.APPLICATION, classDependencies = "org.umu.atica.servicios.gesper.gente.entity.Persona" )
@BypassInterceptors
@Startup
public class ApiumIdentity extends UmuIdentity {
private static final long serialVersionUID = 4315185968632267803L;
private static final Log LOG = Logging.getLog( UmuIdentity.class );
public static final String ROL_ADMINISTRADOR = "ADMIN";
public boolean esUsuarioUmu() {
return ( this.getPersona().getCorreo().endsWith( "@um.es" )
|| this.getPersona().getCorreo().endsWith( "@ticarum.es" ) );
}
public static String getRolAdministrador() {
return ROL_ADMINISTRADOR;
}
public void relogByCAS() {
LOG.debug( "relogByCAS: #0", getCredentials().getUsername() );
unAuthenticate();
Session.instance().invalidate();
if ( Events.exists() ) {
Events.instance().raiseEvent( EVENT_LOGGED_OUT );
}
}
} |
error_auth_method.xhtml
Añadir página de error:
ScopeType;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.core.Events;
import org.jboss.seam.log.Log;
import org.jboss.seam.log.Logging;
import org.jboss.seam.web.Session;
import es.um.atica.seam.security.UmuIdentity;
@Name( "org.jboss.seam.security.identity" )
@Scope( ScopeType.SESSION )
@Install( precedence = Install.APPLICATION, classDependencies = "org.umu.atica.servicios.gesper.gente.entity.Persona" )
@BypassInterceptors
@Startup
public class ApiumIdentity extends UmuIdentity {
private static final long serialVersionUID = 4315185968632267803L;
private static final Log LOG = Logging.getLog( UmuIdentity.class );
public static final String ROL_ADMINISTRADOR = "ADMIN";
public boolean esUsuarioUmu() {
return ( this.getPersona().getCorreo().endsWith( "@um.es" )
|| this.getPersona().getCorreo().endsWith( "@ticarum.es" ) );
}
public static String getRolAdministrador() {
return ROL_ADMINISTRADOR;
}
public void relogByCAS() {
LOG.debug( "relogByCAS: #0", getCredentials().getUsername() );
unAuthenticate();
Session.instance().invalidate();
if ( Events.exists() ) {
Events.instance().raiseEvent( EVENT_LOGGED_OUT );
}
}
} |
error_template.xhtml
Añadir template para páginas de error:
| Bloque de código |
|---|
| language | xml |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html version="-//W3C//DTD XHTML 1.1//EN"
lang="#{locale.language}" xmlns=" |
| Bloque de código |
|---|
| language | xml |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html version="-//W3C//DTD XHTML 1.1//EN"
lang="#{locale.language}" xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:p="http://primefaces.org/ui"
xmlns:fdw="http://www.um.es/atica/fundeweb"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xsi:schemaLocation="http://www.w3.org/1999/xhtml
http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
<h:head>
<f:facet name="first">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><h:outputText value="#{messages['application.title']}" /></title>
<!-- -->
<link rel="shortcut icon" href="#{request.contextPath}/resources/img/icon.png" />
1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:p="http://primefaces.org/ui"
xmlns:fdw="http://www.um.es/atica/fundeweb"
xsi:schemaLocation="http://www.w3.org/1999/xhtml
http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
<h:head>
<f:facet name="first">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><h:outputText value="#{messages['application.title']}" /></title>
<!-- -->
<link rel="shortcut icon" href="#{request.contextPath}/resources/img/icon.png" />
<ui:insert name="head-first" />
</f:facet>
<f:facet name="last">
<fdw:outputStylesheet library="fundeweb" name="primeflex/2_0/primeflex.min.css" />
<!-- Personalizacion UMU -->
<fdw:outputStylesheet library="themes" name="um/1_1/css/font.css" />
<fdw:outputStylesheet library="themes" name="um/1_1/css/layoutUMU.css" />
<fdw:outputStylesheet library="themes" name="um/1_1/css/estiloUMU.css" />
<!-- Personalizacion de la aplicacion -->
<fdw:outputStylesheet library="css" name="custom.css" />
</f:facet>
</h:head>
<h:body>
<f:view>
<div id="main-wrapper" class="error-page">
<header class="topbar">
<nav class="navbar">
<span class="app-name d-sm-none" style="margin-left: 73px;"> #{messages['application.name']} </span>
<span class="app-name d-md-none"> #{messages['application.name']} </span>
</nav>
</header>
<div class="page-wrapper">
<div class="main-content" style="margin: 0;">
<main class="page-content ui-g">
<div class="ui-g-0 ui-lg-2"></div>
<div class="ui-g-12 ui-lg-8">
<ui:insert name="head-firstbody" />
</f:facet>
<f:facet name="lastdiv>
</main>
<footer class="footerRow clearfix">
<fdw:outputStylesheet library="fundeweb" name="primeflex/2_0/primeflex.min.css" />
<!-- Personalizacion UMU -->
<fdw:outputStylesheet library="themes" name="um/1_1/css/font.css" />
<fdw:outputStylesheet library="themes" name="um/1_1/css/layoutUMU.css" />
<fdw:outputStylesheet library="themes" name="um/1_1/css/estiloUMU.css" />
<!-- Personalizacion de la aplicacion -->
<fdw:outputStylesheet library="css" name="custom.css" /> <span>#{messages['application.foot.universidad']} — #{messages['application.foot.atica']}</span>
<s:fragment rendered="#{init.debug}">
<ui:include src="/layout/pie_debug.xhtml" />
</s:fragment>
</footer>
</div>
</div>
</div>
</f:facet>view>
</h:head>
<h:body>
<f:view>
<div id="main-wrapper" class="error-page">
<header class="topbar">
<nav class="navbar">
<span class="app-name d-sm-none" style="margin-left: 73px;"> #{messages['application.name']} </span>
<span class="app-name d-md-none"> #{messages['application.name']} </span>
</nav>
</header>
<div class="page-wrapper">
<div class="main-content" style="margin: 0;">
<div class="page-content ui-g">
<div class="ui-g-0 ui-lg-2"></div>
<div class="ui-g-12 ui-lg-8">
body>
</html> |
error_auth_method.xhtml
Añadir página de error en el método de autorización.
| Bloque de código |
|---|
| language | xml |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
<ui:composition template="error_template.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:p="http://primefaces.org/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<ui:define name="body">
<h1 class="titulo-pagina">#{messages['page.error.authauthmethod.title']}</h1>
<p class="text-size-big-4 font-weight-medium p-mt-5">
#{messages['page.error.authauthmethod.desc']}
</p>
<ul>
<c:forEach var="_authType" items="#{authenticationManagerBean.authenticationTypes}">
<c:if test="#{not empty _authType.descKey}">
<li>#{messages[_authType.descKey]}</li>
</c:if>
</c:forEach>
</ul>
<h:form>
<p class="text-size-big-4 font-weight-medium p-mt-5" style="margin">
</c:if>#{messages['page.error.authmethod.link.pre']}
</c:forEach><s:link action="#{identity.relogByCAS}" propagation="none"
includePageParams="false" value="#{messages['page.error.authmethod.link']}" />
</ul>
#{messages['page.error.authmethod.link.post']}
</p>
<h</h:form>
<p class="text-size-big-4 font-weight-medium p-mt-5" style="margin">
#{messages['page.error.auth.link.pre']}
<s:link action="#{identity.relogByCAS}" propagation="none"
includePageParams="false" value="cambiar de método de autenticación " />
#</ui:define>
</ui:composition> |
error_no_auth.xhtml
Añadir página de error no autorizado.
| Bloque de código |
|---|
| language | xml |
|---|
| theme | Eclipse |
|---|
| linenumbers | true |
|---|
|
<ui:composition template="error_template.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:p="http://primefaces.org/ui">
<ui:define name="body">
<h1 class="titulo-pagina">#{messages['page.error.authnoauth.link.posttitle']}
</p>h1>
</h:form>
</div>
</div>
<footer<div class="footerRow clearfixtext-size-big-4 font-weight-medium">
<span>#{messages['application.foot.universidad']} — #<p class="p-mt-5">#{messages['applicationpage.error.footnoauth.aticadesc']}</span>p>
<p>
<s:fragment rendered="#{init.debug}">
<ui:include src="/layout/pie_debug.xhtml" />
</s:fragment>
</footer>
</div>
</div>#{messages['page.error.noauth.link.pre']}<p:link class="text-size-big-4" href="https://www.um.es/web/atica/contacto" value="#{messages['page.error.noauth.link']}" />#{messages['page.error.noauth.link.post']}
</p>
</div>
</fui:view>define>
</h:body>
</html>ui:composition> |