• No se han encontrado resultados

CAPÍTULO II ARQUITECTURA PARA EL DESARROLLO DE UN GEOPORTAL 2.0,

3.3 Conclusiones del Capítulo III

Se implementaron los componentes portlets como aplicaciones del geoportal, proporcionando a los usuarios las funcionalidades y herramientas necesarias para la interacción y gestión de la información espacial mediante estándares espaciales. Se establecieron vínculos entre los distintos componentes, obteniéndose un entorno de cooperación que posibilita la aparición de aplicaciones híbridas, que utilizando información de diversas fuentes relevantes crean un nuevo servicio en base a las mismas.

Se desarrolló el caso de estudio del Portal Geoespacial Nacional de la IDERC, mediante el uso e integración de las distintas aplicaciones desarrolladas sobre la arquitectura de Geoliferay, lográndose un geoportal como punto de acceso a la información espacial, pero basado en la participación, donde los usuarios juegan un rol

[98]

CONCLUSIONES

Como resultado de esta investigación se obtuvo la plataforma Geoliferay, para la construcción de portales espaciales, soportando la gestión de IDEs colaborativas dirigidas al usuario basada en estándares abiertos, permitiendo la construcción de un Geoportal 2.0. Los objetivos planteados fueron cumplidos satisfactoriamente:

 Se determinaron los fundamentos teóricos y prácticos referentes a las Infraestructuras de Datos Espaciales y a los portales web geoespaciales dirigidos al usuario, comprobándose que en la mayoría no aparece el uso de la información geográfica generada por los usuarios que posibilite el desarrollo de IDEs colaborativas. Se constató además que la adopción de los principios de la Web 2.0 y la construcción de un Geoportal 2.0 potencia el papel del usuario como uno de los actores fundamentales.

 Se definieron las tecnologías y componentes de software libre que permiten la construcción de un portal web geoespacial. Se analizaron las potencialidades y características de cada una. Se seleccionó a Liferay Portal como plataforma base de desarrollo y se determinaron varios componentes de software del contexto espacial, necesarios para el soporte de los servicios de una IDE: Geoserver como servidor de mapas y objetos geográficos, Geonetwork para la gestión de metadatos, PostgreSQL/Postgis como soporte al almacenamiento de datos espaciales, Deegree como servidor de nombres geográficos y OpenLayers como herramienta de mapeo web. Se escogió a Tocororo como herramienta para la gestión de mapas y datos de usuario desde un entorno colaborativo y a CAS para para el proceso de autenticación común entre las distintas plataformas.

 Se diseñó e implementó una arquitectura de integración entre los distintos componentes de software seleccionados para la construcción del geoportal. La arquitectura definió las relaciones y el intercambio de información entre los componentes que lo integran, tributando a la filosofía de arquitectura participativa y Geoportal 2.0.

[99]

 Se implementaron los componentes de la plataforma que brindan a los usuarios las funcionalidades para la interacción y gestión de la información espacial mediante estándares espaciales. Se establecieron vínculos entre los distintos componentes, obteniéndose un entorno de cooperación que posibilita la aparición de aplicaciones híbridas, incrementando la posibilidad de análisis y visualización de los usuarios.

 Se instanció la solución mediante el caso de estudio del Portal Geoespacial Nacional de la IDERC, lográndose un geoportal instituido como un punto de acceso a la información espacial, pero basado en la participación, donde los usuarios juegan un rol fundamental en el centro de la solución.

[100]

RECOMENDACIONES

Al concluir este trabajo se recomienda:

 Desarrollar en las aplicaciones del geoportal las características de redes sociales que brinda Liferay desde un enfoque de colaboración, basado en los datos geoespaciales del geoportal y extendiendo las relaciones sociales existentes en Liferay con información geoespacial.

 Fortalecer el trabajo con los datos raster, actualmente limitado en el entorno de GeoLiferay.

 Incluir nuevos tipos de servicios y aplicaciones geoespaciales clientes como contenidos de la plataforma, tal es el caso de TJS (Table Joining Service) y WPS (Web Processing Service).

 Desarrollar los elementos que posibiliten la replicación y escalabilidad de la plataforma Geoliferay en la nube y en el entorno propuesto por el modelo IDEaaS.

[101]

REFERENCIAS BIBLIOGRÁFICAS

ISO 19115. (2003). Geographic information - Metadata.

ISO 19119. (2003). Geographic information - Services. .

ISO 19128. (2005). Geographic information - Web map server interface.

Álvarez, M., Delgado, T., & Cruz, R. (2010). Social Networks and Web 2.0 Tools as a

Good Complement to the Local SDI’s. Singapore: GSDI 12.

Álvarez, M., Delgado, T., & Cruz, R. (2010). Social SDI's: a Challenge for Land

Surveyors. Sidney, Australia: XXIV FIG International Congress Proceedings.

Asúnsolo, A. (2009). Qué son y cómo funcionan las Redes Sociales I: Introducción.

Obtenido de http://www.microsoft.com/business/smb/es-es/rrpp/redes_

sociales_intro.mspx

Bernard, E., Ferentschik, H., Fernandes, G., Grinovero, S., Memon, N. A., & Morling, G. (2014). Hibernate Search Apache Lucene™ Integration Reference Guide

4.5.1.Final.

Bordignon, F. (2009). Web 2.0 y la Neogeografia.

Christl, A. (2009). OSGeo - Globally Powering SDIs. Obtenido de

http://arnulf.us/publications/osgeo-globally-powering-sdi_arnulf-christl_v3.pdf

Codina, L. (2009). ¿Web 2.0, Web 3.0 o Web Semántica?: El impacto en los sistemas

de información de la Web? Obtenido de http://www.lluiscodina.com/

Web20_WebSemantica2009_Nov2009.pdf

Coleman, D. (2009). Volunteered Geographic Information.The Nature and Motivation of Produsers. Rotterdam.

Cruz Iglesias, R. (2011). MODELO DE INFRAESTRUCTURA DE DATOS

ESPACIALES BASADA EN COMPUTACIÓN EN LA NUBE.

Dehaes, V. (2008). Tagging, Folksonomies y Tag clouds. Obtenido de

[102]

Delgado Fernández T, C. F. (2009). Marco teórico de Infraestructuras de Datos

Espaciales en el Proyecto CYTED IDEDES. En Semántica Espacial y

Descubrimiento de Conocimiento para Desarrollo Sostenible p. 21-32.

Delgado Fernández, T. (2005). Infraestructuras de Datos Espaciales en países de bajo desarrollo tecnológico. Implementación en Cuba. s.l. : Tesis presentada en

opción al grado científico de Doctor en Ciencias Técnicas.

Delgado Fernández, T. (2009). La Infraestructura de Datos Espaciales de la República

de Cuba, avances y perspectivas. Novena Conferencia Cartográfica Regional de

las Naciones Unidas para América. Obtenido de

https://unstats.un.org/unsd/geoinfo/RCC/docs/rcca9/ip/9th_UNRCCA_econf.99_I P15.pdf

Delgado Fernández, T., & Castellanos Abella, E. (2006). Towards user-driven spatial

data infrastructures. An approach oriented to sustainable development. Santiago,

Chile.

Delgado, T. C. (2007). Infraestructuras de Datos Espaciales en Iberoamérica y el

Caribe. Habana: IDICT.

Delgado, T., & Capote, J. L. (2009). Semántica Geoespacial y descubrimiento de

conocimiento para Desarrollo Sostenible. La Habana, Cuba: CUJAE.

Delgado, T., & Cruz Iglesias, R. (2009). Construyendo Infraestructuras de Datos

Espaciales a nivel local. La Habana, Cuba.

DOYLE A., R. C. (2001). Introduction to OGC Web Services. . Obtenido de http://ip.opengis.org/ows/010526_OWSWhitepaper.doc

ESRI. (Julio de 1998). ESRI Shapefile Technical Description. Recuperado el 2014, de www.esri.com/library/whitepapers/pdfs/shapefile.pdf

ESRI. (2009). GIS Portal Technology. Recuperado el 2012, de

http://www.esri.com/library/whitepapers/pdfs/gisportal.pdf

Fernández, R., Cruz, R., & Capote, J. (2011). Aplicación Web de nombres geográficos

[103]

Freire, M. (2008.). Redes Sociales Definicion. Obtenido de http://michfer. wordpress.com/2008/08/07/redes-sociales-definicion

Gartner. (Octubre de 2014). Magic Quadrant for Horizontal Portals. Obtenido de

Gartner: http://www.gartner.com/technology/reprints.do?id=1-

22PHCII&ct=141002&st=sg

GeoNetwork opensource Developers. (2012). GeoNetwork User Manual v2.6.4.

Goodchild, M. F. (2007). Citizens as sensors: the world of volunteered geography.

GeoJournal.

Gould, M. (2008). Neogeografía: ¿ventaja o preocupación? Barcelona.

Halil Akinci, Ç. C. (2009). GEOPORTALS AND THEIR ROLE IN SPATIAL DATA.

Hibernate. (2004). Hibernate Community Documentation, Chapter 12. Interceptors and

events. Recuperado el Mayo de 2014, de

https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/events.html

Holmes, C. (2009). Towards an Open Geo Web: Linking Open Source's "Architectures

of Participation" to the Global SDI Initiative.

Hudson-Smith, D. A. (Agosto de 2008). The Renaissance of Geographic Information:

Neogeography, Gaming and Second Life.

ISO. (2002). ISO 19125-1: Geographic information – Simple Feature Access.

ISO. (2007). ISO/TS 19139:2007 - Geographic information -- Metadata. Obtenido de www.iso.org/iso/catalogue_detail.htm?csnumber=32557

ISO/FDIS 19101. (2001). Draft International Standard. Geographic Information – Reference. Obtenido de http://www.isotc.org/

JASIG. (2009). Welcome-CAS. Obtenido de http://www.jasig.org/cas

Lake, R. (2009). GeoWeb Vision - Technical Requirements. Galdos Systems Inc.

Landmap Geoknowledge. (s.f.). Introduction to Geoportal Software. Recuperado el

enero de 2014, de http://www.landmap.ac.uk/index.php/Learning-

[104]

Lemmens, R., & Deng, D. (2008). Web 2.0 and Semantic Web: Clarifying the meaning

of spatial features. Workshop "Semantic Web meets Geopatial Applications",

AGILE 2008.

Lorenzo, H. (2013). Manual de Usuario de Tocororo.

Lorenzo, H., & Capote Fernández, J. (2013). Tocororo, Servicio De Datos Temáticos

Georreferenciados En La Nube. La Habana, Cuba: Congreso Internacional

Geomática.

Maguire, D. (2006). GeoWeb2.0: Implications for ESDI. 12 EC-GI&GIS Workshop.

Obtenido de http://www.ec-gis.org/Workshops/12ec-gis/presentations/

Plenaryroom/ Opening/GeoWeb2_2.pdf

Maguire, D. (2008). GeoWeb 2.0 and Volunteered GI. Obtenido de

http://www.ncgia.ucsb.edu/projects/vgi/docs/position/Maguire_paper.pdf

Maguire, D., & Longley, P. (2004). The Emergence of Geoportals and Their Role in

Spatial Data Infrastructures. Elsevier Ltd.

Méndez, J. C. (2007). Neogeografía, Web 2.0, Web Geoespacial y Mashups: Una

Geografía para todos. Colombia.

Moreno, R. (2012). Free and Open Source Software for Geospatial Applications

(FOSS4G): A Mature Alternative in the Geospatial Technologies Arena. Guest.

Nebert, D. D. (Enero de 2004). Spatial Data Infrastructure Cookbook v2.0. Recuperado

el Febrero de 2012, de

http://www.gsdi.org/docs2004/Cookbook/cookbookV2.0.pdf

O´Reilly, T. (Junio de 2004). The Architecture of Participation. Obtenido de O´Reilly: http://archive.oreilly.com/pub/a/oreilly/tim/articles/architecture_of_participation.ht ml

OBE, R. A. (2011). PostGIS in Action. Greenwich, CT, USA: Manning Publications Co.

OGC. (1999). Simple Features Specification for SQL. 1999. Obtenido de http://portal.opengeospatial.org/ files/?artifact_id=829.

[105]

OGC. (2003). GOS-Portal Implementation Architecture OGC 03-xxx. OpenGIS

Interoperability Program Report.

OGC. (2003). OGC Geography Markup Language (GML) 3.0 Specification. OGC

Document No.02-023r4. Obtenido de http://www.opengis.net/gml/

OGC. (2003). OGC Reference Model. Obtenido de http://portal.opengeospatial.org/ files/?artifact_id=3836.

OGC. (2005). OGC Web Coverage Service (WCS) Specification. . Obtenido de http://www.opengis.org/

OGC. (2005). OGC Web Feature Service (WFS) Implementation Specification.

Obtenido de OGC Document No. 04-094: http://www.opengis.org/

OGC. (2006). Catalog Services (CSW) Specification, OGC Document. Obtenido de http://www.opengis.org

OGC. (2007). OGC Web Processing Service (WPS). Implementation specification. Obtenido de http://www.opengeospatial.org/ standards/wps

OGC. (2009). OpenGIS Web Map Service. OGC Implementation Specification OGC 01-

068r3. Obtenido de http://www.opengeospatial.org/standards/wms

OGC Geospatial One-StopPortal Initiative. (2002). Call for Quotation and Call for

Participation,Annex B: Candidate Portal Architecture.

OGC. (s.f.). OGC Web Feature Service (WFS) Implementation Specification. Obtenido de http://www.opengis.org/

Open Geospatial Consortium Inc. (2004). Geospatial Portal Reference Architecture.

Open Geospatial Consortium Inc. (2007). Styled Layer Descriptor profile of the Web

Map Service Implementation Specification.

O'Reilly, T., & Battelle, J. (2009). Web Squared: Web 2.0 Five Years On 2009. Obtenido de http://assets.en.oreilly.com/1/event/28/web2009_websquared-whitepaper.pdf

Parson, E. (Junio 2009). The age of the citizen cartographer. Building SDI’s from the

[106]

Pérez, M. (2006). Qué son las redes sociales :: Concepto y definición de redes

sociales. Obtenido de http://www.innatia.com/s/c-coaching/a-que-son-redes-

sociales.html

Rajabifard, A., & Willianson, I. (2001). Spatial Data Infrastructures: Concept SDI

Heirarchy and Future Directions. Tehran, Iran: GEOMATICS80.

Richard Sezov, J. (2007). Liferay Plugin Development Guide. Liferay, Inc,.

Richard Sezov, J. (2012). Liferay in Action, The Official Guide to Liferay Portal

Development. NY : Manning Publications Co.

Rodríguez, A. F. (2009). Evolución del Geoportal IDEE: mirando hacia la comunidad.

Obtenido de JIDEE 2009: http://www.idee.es/resources/

presentaciones/GTIDEE_Murcia_2009/ARTICULOS_JIDEE2009/Articulo-22.pdf

Rodríguez, A. F., Mas, S., Abad, P., Alonso, J. A., Ayuso, J. E., Sánchez, A., & Vilches, L. M. (2008). Una nueva etapa: Hacia la IDE 2.0.

Sezov, R., Hinkey, J., Kostas, S., Rao, J., & Hoag, C. (2013). Using Liferay Portal A

Complete Guide.

Stefanakis, E., & Prastacos, P. (2008). Development of a Coastal SDI using GeoFOSS.

Obtenido de http://www.agile-

online.org/Conference_Paper/CDs/agile_2008/PDF/69_DOC.pdf

Steiniger, S., & Hunter, A. (2010). Free and Open Source GIS Software for Building a

Spatial Data Infrastructure. Obtenido de

http://www.geo.uzh.ch/~sstein/manuscripts/sstein_hunter_fosgis4sdi_v10_final.p df

SUN Microsystem Inc. (1997). Java Beans TM Version 1.01. Mountain View.

Tait, M. (2004). Implementing geoportals: applications of distributed GIS. Environ. And Urban Systems.

[107]

Ugarte, D. D. (2009). El poder de las redes. Obtenido de

www.deugarte.com/gomi/el_poder_de_las_redes.pdf

Van Der Henst, C. (2007). ¿Qué es la Web 2.0? . Obtenido de

http://www.maestrosdelweb.com

Wikilibros. (2009). Análisis de Redes Sociales/Conceptos Fundamentales. Obtenido de http://es.wikibooks.org/wiki/Análisis_de_Redes_Sociales

Williamson, I. (2002). Land Administration and Spatial Data Infrastructures – Trends

and Developments. Washington DC,USA.

Wong Simón, M. (2011). Visor de mapas genérico usando software libre. La Habana, Cuba: Congreso Internacional GEOMATICA.

World Wide Web Consortium (W3C). (24 de Diciembre de 1999). HTML 4.01

Specification W3C Recommendation. Obtenido de Frames:

http://www.w3.org/TR/html401/present/frames.html#h-16.5

Yarmosh, K. (2005). Web 2.0 Bussiness Models. Obtenido de

http://www.technosight.com/category/strategy-and-marketing

Yuan, J. X. (2012). Liferay Portal Systems Development. Birmingham: Packt Publishing Ltd.

[108]

ANEXOS

Anexo 1 Fichero de Configuración de Spring de Tocororo para usar CAS.

Fichero de configuración applicationContext-security-cas.xml.

<security:http entry-point-ref="casAuthenticationEntryPoint" auto-config="true"> <security:intercept-url pattern="/*.jsp" access="ROLE_REGISTRED"></security:intercept-url> <security:custom-filter position="CAS_FILTER" ref="casAuthenticationFilter"></security:custom-filter> <security:custom-filter ref="requestSingleLogoutFilter" before="LOGOUT_FILTER" /> <security:custom-filter ref="singleLogoutFilter" before="CAS_FILTER" /> </security:http>

<!-- Required for the casProcessingFilter, so define it explicitly set and

specify an Id Even though the authenticationManager is created by default when namespace based config is used. -->

<security:authentication-manager alias="authenticationManager"> <security:authentication-provider

ref="casAuthenticationProvider"></security:authentication-provider> </security:authentication-manager>

<!-- This section is used to configure CAS. The service is the actual redirect that will be triggered after the CAS login sequence. -->

<bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties"> <property name="service"

value="${cas.serviceProperties}/j_spring_cas_security_check"></property> <property name="sendRenew" value="false"></property>

</bean>

[109] the ticket validation. -->

<bean id="casAuthenticationFilter"

class="org.springframework.security.cas.web.CasAuthenticationFilter">

<property name="authenticationManager" ref="authenticationManager"></property> </bean>

<!-- The entryPoint intercepts all the CAS authentication requests. It redirects to the CAS loginUrl for the CAS login page. -->

<bean id="casAuthenticationEntryPoint"

class="org.springframework.security.cas.web.CasAuthenticationEntryPoint"> <property name="loginUrl" value="${cas.authenticationEntryPoint}"></property> <property name="serviceProperties" ref="serviceProperties"></property> </bean>

<!-- This filter handles a Single Logout Request from the CAS Server -->

<bean id="singleLogoutFilter" class="org.jasig.cas.client.session.SingleSignOutFilter" /> <!-- This filter redirects to the CAS Server to signal Single Logout should

be performed --> <bean id="requestSingleLogoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter" p:filterProcessesUrl="/j_spring_cas_security_logout"> <constructor-arg value="${cas.requestSingleLogoutFilter}" /> <constructor-arg> <bean class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler" /> </constructor-arg> </bean>

<!-- Handles the CAS ticket processing. --> <bean id="casAuthenticationProvider"

class="org.springframework.security.cas.authentication.CasAuthenticationProvider"> <property name="userDetailsService" ref="userService"></property>

<property name="serviceProperties" ref="serviceProperties"></property> <property name="ticketValidator">

<bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator"

p:proxyCallbackUrl="${cas.ticketValidator}/j_spring_cas_security_proxyreceptor"> <constructor-arg index="0"

[110]

value="${cas.ticketValidatorValue}" /> </bean>

</property>

<property name="key" value="cas"></property> </bean>

<bean id="userService" class="gmx.iderc.tocororo.server.service.impl.shared.UserDetailsServiceImpl" /> </beans>

Anexo 2 Fichero de Configuración de CAS.

<bean class="org.jasig.cas.adaptors.jdbc.SearchModeSearchDatabaseAuthenticationHandler"> <property name="tableUsers"> <value>User_</value> </property> <property name="fieldUser"> <value>emailAddress</value> </property> <property name="fieldPassword"> <value>password_</value> </property> <property name="passwordEncoder">

<bean class="com.mycompany.LiferayPasswordEncoder">

<!-- Default Liferay Password Encryption is SHA algorithm. If someone changes it in liferay it have to been changed here--> <constructor-arg name="encodingAlgorithm" value="SHA"></constructor-arg>

</bean></property><property name="dataSource" ref="dataSource"></property> </bean> </list> </property>

<!-- Data source definition point to Liferay database -->

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">

<property name="driverClassName"> <value>com.mysql.jdbc.Driver</value></property>

<property name="url"><value>jdbc:mysql://yourLiferayDatabaseHostAndPort:3306/lportal</value> </property>

<property name="username"><value>${user.name}</value>

</property><property name="password"> <value>${user.name}</value> </property>

</bean>

Anexo 3 Clase de CAS que permite codificar la contraseña almacenada en

Liferay

[111]

public class LiferayPasswordEncoder implements PasswordEncoder { public static final String UTF8 = "UTF-8";

public static final String TYPE_CRYPT = "CRYPT"; public static final String TYPE_MD2 = "MD2"; public static final String TYPE_MD5 = "MD5"; public static final String TYPE_NONE = "NONE";

public static final String TYPE_SHA = "SHA";

public static final String TYPE_SHA_256 = "SHA-256"; public static final String TYPE_SHA_384 = "SHA-384"; public static final String TYPE_SSHA = "SSHA";

public static final DigesterImpl digesterImpl = new DigesterImpl(); @NotNull

private static String PASSWORDS_ENCRYPTION_ALGORITHM = TYPE_SHA; public LiferayPasswordEncoder() {

}

public LiferayPasswordEncoder(final String encodingAlgorithm) { PASSWORDS_ENCRYPTION_ALGORITHM = encodingAlgorithm; }

public static final char[] saltChars =

"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./" .toCharArray();

public static String encrypt(String clearTextPassword) {

return encrypt(PASSWORDS_ENCRYPTION_ALGORITHM, clearTextPassword, null); }

public static String encrypt(String clearTextPassword, String currentEncryptedPassword) {

return encrypt(PASSWORDS_ENCRYPTION_ALGORITHM, clearTextPassword, currentEncryptedPassword);

}

public static String encrypt(String algorithm, String clearTextPassword, String currentEncryptedPassword) {

if (algorithm.equals(TYPE_CRYPT)) {

byte[] saltBytes = _getSaltFromCrypt(currentEncryptedPassword); return encodePassword(algorithm, clearTextPassword, saltBytes); } else if (algorithm.equals(TYPE_NONE)) {

return clearTextPassword;

} else if (algorithm.equals(TYPE_SSHA)) {

byte[] saltBytes = _getSaltFromSSHA(currentEncryptedPassword); return encodePassword(algorithm, clearTextPassword, saltBytes);

[112]

} else {

return encodePassword(algorithm, clearTextPassword, null); }

}

protected static String encodePassword(String algorithm, String clearTextPassword, byte[] saltBytes) { try {

if (algorithm.equals(TYPE_CRYPT)) {

return Crypt.crypt(saltBytes, clearTextPassword.getBytes(UTF8)); } else if (algorithm.equals(TYPE_SSHA)) {

byte[] clearTextPasswordBytes = clearTextPassword .getBytes(UTF8);

byte[] pwdPlusSalt = new byte[clearTextPasswordBytes.length + saltBytes.length];

System.arraycopy(clearTextPasswordBytes, 0, pwdPlusSalt, 0, clearTextPasswordBytes.length);

System.arraycopy(saltBytes, 0, pwdPlusSalt,

clearTextPasswordBytes.length, saltBytes.length); // Digest byte array

MessageDigest sha1Digest = MessageDigest.getInstance("SHA-1"); byte[] pwdPlusSaltHash = sha1Digest.digest(pwdPlusSalt);

byte[] digestPlusSalt = new byte[pwdPlusSaltHash.length + saltBytes.length];

System.arraycopy(pwdPlusSaltHash, 0, digestPlusSalt, 0, pwdPlusSaltHash.length);

System.arraycopy(saltBytes, 0, digestPlusSalt, pwdPlusSaltHash.length, saltBytes.length); // Base64 encode and format string

return Base64.encode(digestPlusSalt); } else {

return digesterImpl.digest(algorithm, clearTextPassword); }

} catch (NoSuchAlgorithmException nsae) {

throw new SecurityException("LiferayPasswordEncryption error:" + nsae.getMessage(), nsae);

} catch (UnsupportedEncodingException uee) {

throw new SecurityException("LiferayPasswordEncryption error:" + uee.getMessage(), uee);

} }

[113]

byte[] saltBytes = null; try {

if (Validator.isNull(cryptString)) { // Generate random salt

Random random = new Random(); int numSaltChars = saltChars.length; StringBuilder sb = new StringBuilder();

int x = random.nextInt(Integer.MAX_VALUE) % numSaltChars; int y = random.nextInt(Integer.MAX_VALUE) % numSaltChars; sb.append(saltChars[x]);

sb.append(saltChars[y]); String salt = sb.toString();

saltBytes = salt.getBytes(Digester.ENCODING); } else {

// Extract salt from encrypted password String salt = cryptString.substring(0, 2);

saltBytes = salt.getBytes(Digester.ENCODING); }

} catch (UnsupportedEncodingException uee) { throw new SecurityException(

"Unable to extract salt from encrypted password: " + uee.getMessage(), uee);

}

return saltBytes; }

private static byte[] _getSaltFromSSHA(String sshaString) { byte[] saltBytes = new byte[8];

if (Validator.isNull(sshaString)) { // Generate random salt

Random random = new SecureRandom(); random.nextBytes(saltBytes);

} else {

// Extract salt from encrypted password try {

byte[] digestPlusSalt = Base64.decode(sshaString); byte[] digestBytes = new byte[digestPlusSalt.length - 8]; System.arraycopy(digestPlusSalt, 0, digestBytes, 0, digestBytes.length);

System.arraycopy(digestPlusSalt, digestBytes.length, saltBytes, 0, saltBytes.length); } catch (Exception e) {

[114]

"Unable to extract salt from encrypted password: " + e.getMessage(), e);

} }

return saltBytes; }

public String encode(String pwd) { return encrypt(pwd);

} }

Anexo 4 XML de servicio, implementado para definir las entidades