Commit 1db622dead93599a01e7a03e6cb39ddb1ca7d40d
1 parent
c94c9706
Exists in
master
Movendo o BasiFilter e seus testes da extensão servlet para a rest
Showing
16 changed files
with
1485 additions
and
184 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,66 @@ |
| 1 | +<!-- | |
| 2 | + Demoiselle Framework | |
| 3 | + Copyright (C) 2010 SERPRO | |
| 4 | + ============================================================================ | |
| 5 | + This file is part of Demoiselle Framework. | |
| 6 | + | |
| 7 | + Demoiselle Framework is free software; you can redistribute it and/or | |
| 8 | + modify it under the terms of the GNU Lesser General Public License version 3 | |
| 9 | + as published by the Free Software Foundation. | |
| 10 | + | |
| 11 | + This program is distributed in the hope that it will be useful, | |
| 12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | + GNU General Public License for more details. | |
| 15 | + | |
| 16 | + You should have received a copy of the GNU Lesser General Public License version 3 | |
| 17 | + along with this program; if not, see <http://www.gnu.org/licenses /> | |
| 18 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
| 19 | + Fifth Floor, Boston, MA 02110-1301, USA. | |
| 20 | + ============================================================================ | |
| 21 | + Este arquivo é parte do Framework Demoiselle. | |
| 22 | + | |
| 23 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
| 24 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
| 25 | + do Software Livre (FSF). | |
| 26 | + | |
| 27 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
| 28 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
| 29 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
| 30 | + para maiores detalhes. | |
| 31 | + | |
| 32 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
| 33 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses /> | |
| 34 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | |
| 35 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
| 36 | +--> | |
| 37 | +<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 38 | + xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> | |
| 39 | + | |
| 40 | + <!-- | |
| 41 | + --> | |
| 42 | + <engine> | |
| 43 | + <property name="deploymentExportPath">target/deployments</property> | |
| 44 | + </engine> | |
| 45 | + | |
| 46 | + <!-- | |
| 47 | + <extension qualifier="selenium"> | |
| 48 | + <property name="browser">*googlechrome</property> | |
| 49 | + </extension> | |
| 50 | + --> | |
| 51 | + | |
| 52 | + <container qualifier="glassfish-embedded" default="true"> | |
| 53 | + <configuration> | |
| 54 | + <property name="configurationXml">src/test/resources/domain.xml</property> | |
| 55 | + </configuration> | |
| 56 | + </container> | |
| 57 | + | |
| 58 | + <!-- | |
| 59 | + <container qualifier="jbossas-managed" default="true"> | |
| 60 | + <protocol type="Servlet 3.0" /> | |
| 61 | + <configuration> | |
| 62 | + <property name="jbossHome">target/jboss-as-${jboss.as.version}</property> | |
| 63 | + </configuration> | |
| 64 | + </container> | |
| 65 | + --> | |
| 66 | +</arquillian> | ... | ... |
| ... | ... | @@ -0,0 +1,417 @@ |
| 1 | +<domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" version="23"> | |
| 2 | + <system-applications> | |
| 3 | + <application context-root="" location="${com.sun.aas.installRootURI}/lib/install/applications/__admingui" name="__admingui" directory-deployed="true" object-type="system-admin"> | |
| 4 | + <module name="__admingui"> | |
| 5 | + <engine sniffer="web"></engine> | |
| 6 | + <engine sniffer="security"></engine> | |
| 7 | + </module> | |
| 8 | + </application> | |
| 9 | + </system-applications> | |
| 10 | + <applications></applications> | |
| 11 | + <resources> | |
| 12 | + <jdbc-resource pool-name="__TimerPool" jndi-name="jdbc/__TimerPool" object-type="system-admin"></jdbc-resource> | |
| 13 | + <jdbc-resource pool-name="DerbyPool" jndi-name="jdbc/__default"></jdbc-resource> | |
| 14 | + <jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource" name="__TimerPool"> | |
| 15 | + <property name="databaseName" value="${com.sun.aas.instanceRoot}/lib/databases/ejbtimer"></property> | |
| 16 | + <property name="connectionAttributes" value=";create=true"></property> | |
| 17 | + </jdbc-connection-pool> | |
| 18 | + <jdbc-connection-pool is-isolation-level-guaranteed="false" datasource-classname="org.apache.derby.jdbc.ClientDataSource" res-type="javax.sql.DataSource" name="DerbyPool"> | |
| 19 | + <property name="PortNumber" value="1527"></property> | |
| 20 | + <property name="Password" value="APP"></property> | |
| 21 | + <property name="User" value="APP"></property> | |
| 22 | + <property name="serverName" value="localhost"></property> | |
| 23 | + <property name="DatabaseName" value="sun-appserv-samples"></property> | |
| 24 | + <property name="connectionAttributes" value=";create=true"></property> | |
| 25 | + </jdbc-connection-pool> | |
| 26 | + </resources> | |
| 27 | + <servers> | |
| 28 | + <server name="server" config-ref="server-config"> | |
| 29 | + <application-ref ref="__admingui" virtual-servers="__asadmin"></application-ref> | |
| 30 | + <resource-ref ref="jdbc/__TimerPool"></resource-ref> | |
| 31 | + <resource-ref ref="jdbc/__default"></resource-ref> | |
| 32 | + </server> | |
| 33 | + </servers> | |
| 34 | + <nodes> | |
| 35 | + <node node-host="localhost" name="localhost-domain1" type="CONFIG" install-dir="${com.sun.aas.productRoot}"></node> | |
| 36 | + </nodes> | |
| 37 | + <configs> | |
| 38 | + <config name="server-config"> | |
| 39 | + <http-service> | |
| 40 | + <access-log></access-log> | |
| 41 | + <virtual-server id="server" network-listeners="http-listener-1,http-listener-2"></virtual-server> | |
| 42 | + <virtual-server id="__asadmin" network-listeners="admin-listener"></virtual-server> | |
| 43 | + </http-service> | |
| 44 | + <iiop-service> | |
| 45 | + <orb use-thread-pool-ids="thread-pool-1"></orb> | |
| 46 | + <iiop-listener port="3700" id="orb-listener-1" address="0.0.0.0" lazy-init="true"></iiop-listener> | |
| 47 | + <iiop-listener port="3820" id="SSL" address="0.0.0.0" security-enabled="true"> | |
| 48 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl> | |
| 49 | + </iiop-listener> | |
| 50 | + <iiop-listener port="3920" id="SSL_MUTUALAUTH" address="0.0.0.0" security-enabled="true"> | |
| 51 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as" client-auth-enabled="true"></ssl> | |
| 52 | + </iiop-listener> | |
| 53 | + </iiop-service> | |
| 54 | + <admin-service system-jmx-connector-name="system" type="das-and-server"> | |
| 55 | + <jmx-connector port="8686" address="0.0.0.0" security-enabled="false" auth-realm-name="admin-realm" name="system"></jmx-connector> | |
| 56 | + <property name="adminConsoleContextRoot" value="/admin"></property> | |
| 57 | + <property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war"></property> | |
| 58 | + <property name="ipsRoot" value="${com.sun.aas.installRoot}/.."></property> | |
| 59 | + <das-config></das-config> | |
| 60 | + </admin-service> | |
| 61 | + <connector-service></connector-service> | |
| 62 | + <web-container> | |
| 63 | + <session-config> | |
| 64 | + <session-manager> | |
| 65 | + <manager-properties></manager-properties> | |
| 66 | + <store-properties></store-properties> | |
| 67 | + </session-manager> | |
| 68 | + <session-properties></session-properties> | |
| 69 | + </session-config> | |
| 70 | + </web-container> | |
| 71 | + <ejb-container session-store="${com.sun.aas.instanceRoot}/session-store"> | |
| 72 | + <ejb-timer-service></ejb-timer-service> | |
| 73 | + </ejb-container> | |
| 74 | + <mdb-container></mdb-container> | |
| 75 | + <jms-service default-jms-host="default_JMS_host"> | |
| 76 | + <jms-host host="localhost" name="default_JMS_host"></jms-host> | |
| 77 | + </jms-service> | |
| 78 | + <security-service> | |
| 79 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm"> | |
| 80 | + <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile"></property> | |
| 81 | + <property name="jaas-context" value="fileRealm"></property> | |
| 82 | + </auth-realm> | |
| 83 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file"> | |
| 84 | + <property name="file" value="src/test/resources/keyfile"></property> | |
| 85 | + <property name="jaas-context" value="fileRealm"></property> | |
| 86 | + </auth-realm> | |
| 87 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate"></auth-realm> | |
| 88 | + <jacc-provider policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default" policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl"> | |
| 89 | + <property name="repository" value="${com.sun.aas.instanceRoot}/generated/policy"></property> | |
| 90 | + </jacc-provider> | |
| 91 | + <jacc-provider policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory"></jacc-provider> | |
| 92 | + <audit-module classname="com.sun.enterprise.security.Audit" name="default"> | |
| 93 | + <property name="auditOn" value="false"></property> | |
| 94 | + </audit-module> | |
| 95 | + <message-security-config auth-layer="SOAP"> | |
| 96 | + <provider-config provider-type="client" provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule"> | |
| 97 | + <request-policy auth-source="content"></request-policy> | |
| 98 | + <response-policy auth-source="content"></response-policy> | |
| 99 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 100 | + <property name="signature.key.alias" value="s1as"></property> | |
| 101 | + <property name="dynamic.username.password" value="false"></property> | |
| 102 | + <property name="debug" value="false"></property> | |
| 103 | + </provider-config> | |
| 104 | + <provider-config provider-type="client" provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule"> | |
| 105 | + <request-policy auth-source="content"></request-policy> | |
| 106 | + <response-policy auth-source="content"></response-policy> | |
| 107 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 108 | + <property name="signature.key.alias" value="s1as"></property> | |
| 109 | + <property name="dynamic.username.password" value="false"></property> | |
| 110 | + <property name="debug" value="false"></property> | |
| 111 | + <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property> | |
| 112 | + </provider-config> | |
| 113 | + <provider-config provider-type="server" provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule"> | |
| 114 | + <request-policy auth-source="content"></request-policy> | |
| 115 | + <response-policy auth-source="content"></response-policy> | |
| 116 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 117 | + <property name="signature.key.alias" value="s1as"></property> | |
| 118 | + <property name="debug" value="false"></property> | |
| 119 | + </provider-config> | |
| 120 | + <provider-config provider-type="server" provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule"> | |
| 121 | + <request-policy auth-source="content"></request-policy> | |
| 122 | + <response-policy auth-source="content"></response-policy> | |
| 123 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 124 | + <property name="signature.key.alias" value="s1as"></property> | |
| 125 | + <property name="debug" value="false"></property> | |
| 126 | + <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property> | |
| 127 | + </provider-config> | |
| 128 | + </message-security-config> | |
| 129 | + <message-security-config auth-layer="HttpServlet"> | |
| 130 | + <provider-config provider-type="server" provider-id="GFConsoleAuthModule" class-name="org.glassfish.admingui.common.security.AdminConsoleAuthModule"> | |
| 131 | + <request-policy auth-source="sender"></request-policy> | |
| 132 | + <response-policy></response-policy> | |
| 133 | + <property name="restAuthURL" value="http://localhost:${ADMIN_LISTENER_PORT}/management/sessions"></property> | |
| 134 | + <property name="loginPage" value="/login.jsf"></property> | |
| 135 | + <property name="loginErrorPage" value="/loginError.jsf"></property> | |
| 136 | + </provider-config> | |
| 137 | + </message-security-config> | |
| 138 | + <property name="default-digest-algorithm" value="SHA-256"></property> | |
| 139 | + </security-service> | |
| 140 | + <transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs"></transaction-service> | |
| 141 | + <java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009" system-classpath="" classpath-suffix=""> | |
| 142 | + <jvm-options>-XX:MaxPermSize=192m</jvm-options> | |
| 143 | + <jvm-options>-XX:PermSize=64m</jvm-options> | |
| 144 | + <jvm-options>-client</jvm-options> | |
| 145 | + <jvm-options>-Djava.awt.headless=true</jvm-options> | |
| 146 | + <jvm-options>-Djavax.management.builder.initial=com.sun.enterprise.v3.admin.AppServerMBeanServerBuilder</jvm-options> | |
| 147 | + <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options> | |
| 148 | + <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options> | |
| 149 | + <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options> | |
| 150 | + <jvm-options>-Djava.security.auth.login.config=src/test/resources/login.conf</jvm-options> | |
| 151 | + <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options> | |
| 152 | + <jvm-options>-Xmx512m</jvm-options> | |
| 153 | + <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options> | |
| 154 | + <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options> | |
| 155 | + <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options> | |
| 156 | + <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options> | |
| 157 | + <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options> | |
| 158 | + <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options> | |
| 159 | + <jvm-options>-Dosgi.shell.telnet.port=6666</jvm-options> | |
| 160 | + <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options> | |
| 161 | + <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options> | |
| 162 | + <jvm-options>-Dgosh.args=--nointeractive</jvm-options> | |
| 163 | + <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options> | |
| 164 | + <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options> | |
| 165 | + <jvm-options>-Dfelix.fileinstall.log.level=2</jvm-options> | |
| 166 | + <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options> | |
| 167 | + <jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options> | |
| 168 | + <jvm-options>-Dfelix.fileinstall.disableConfigSave=false</jvm-options> | |
| 169 | + <jvm-options>-XX:NewRatio=2</jvm-options> | |
| 170 | + </java-config> | |
| 171 | + <network-config> | |
| 172 | + <protocols> | |
| 173 | + <protocol name="http-listener-1"> | |
| 174 | + <http default-virtual-server="server" max-connections="250"> | |
| 175 | + <file-cache></file-cache> | |
| 176 | + </http> | |
| 177 | + </protocol> | |
| 178 | + <protocol security-enabled="true" name="http-listener-2"> | |
| 179 | + <http default-virtual-server="server" max-connections="250"> | |
| 180 | + <file-cache></file-cache> | |
| 181 | + </http> | |
| 182 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl> | |
| 183 | + </protocol> | |
| 184 | + <protocol name="admin-listener"> | |
| 185 | + <http default-virtual-server="__asadmin" max-connections="250" encoded-slash-enabled="true"> | |
| 186 | + <file-cache></file-cache> | |
| 187 | + </http> | |
| 188 | + </protocol> | |
| 189 | + </protocols> | |
| 190 | + <network-listeners> | |
| 191 | + <network-listener port="8080" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener> | |
| 192 | + <network-listener port="8181" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener> | |
| 193 | + <network-listener port="4848" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="admin-thread-pool"></network-listener> | |
| 194 | + </network-listeners> | |
| 195 | + <transports> | |
| 196 | + <transport name="tcp"></transport> | |
| 197 | + </transports> | |
| 198 | + </network-config> | |
| 199 | + <thread-pools> | |
| 200 | + <thread-pool name="admin-thread-pool" max-thread-pool-size="50" max-queue-size="256"></thread-pool> | |
| 201 | + <thread-pool name="http-thread-pool"></thread-pool> | |
| 202 | + <thread-pool name="thread-pool-1" max-thread-pool-size="200"></thread-pool> | |
| 203 | + </thread-pools> | |
| 204 | + <monitoring-service> | |
| 205 | + <module-monitoring-levels></module-monitoring-levels> | |
| 206 | + </monitoring-service> | |
| 207 | + <group-management-service> | |
| 208 | + <failure-detection></failure-detection> | |
| 209 | + </group-management-service> | |
| 210 | + </config> | |
| 211 | + <config name="default-config"> | |
| 212 | + <http-service> | |
| 213 | + <access-log></access-log> | |
| 214 | + <virtual-server id="server" network-listeners="http-listener-1, http-listener-2"> | |
| 215 | + <property name="default-web-xml" value="${com.sun.aas.instanceRoot}/config/default-web.xml"></property> | |
| 216 | + </virtual-server> | |
| 217 | + <virtual-server id="__asadmin" network-listeners="admin-listener"></virtual-server> | |
| 218 | + </http-service> | |
| 219 | + <iiop-service> | |
| 220 | + <orb use-thread-pool-ids="thread-pool-1"></orb> | |
| 221 | + <iiop-listener port="${IIOP_LISTENER_PORT}" id="orb-listener-1" address="0.0.0.0"></iiop-listener> | |
| 222 | + <iiop-listener port="${IIOP_SSL_LISTENER_PORT}" id="SSL" address="0.0.0.0" security-enabled="true"> | |
| 223 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl> | |
| 224 | + </iiop-listener> | |
| 225 | + <iiop-listener port="${IIOP_SSL_MUTUALAUTH_PORT}" id="SSL_MUTUALAUTH" address="0.0.0.0" security-enabled="true"> | |
| 226 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as" client-auth-enabled="true"></ssl> | |
| 227 | + </iiop-listener> | |
| 228 | + </iiop-service> | |
| 229 | + <admin-service system-jmx-connector-name="system"> | |
| 230 | + <jmx-connector port="${JMX_SYSTEM_CONNECTOR_PORT}" address="0.0.0.0" security-enabled="false" auth-realm-name="admin-realm" name="system"></jmx-connector> | |
| 231 | + <property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war"></property> | |
| 232 | + <das-config></das-config> | |
| 233 | + </admin-service> | |
| 234 | + <web-container> | |
| 235 | + <session-config> | |
| 236 | + <session-manager> | |
| 237 | + <manager-properties></manager-properties> | |
| 238 | + <store-properties></store-properties> | |
| 239 | + </session-manager> | |
| 240 | + <session-properties></session-properties> | |
| 241 | + </session-config> | |
| 242 | + </web-container> | |
| 243 | + <ejb-container session-store="${com.sun.aas.instanceRoot}/session-store"> | |
| 244 | + <ejb-timer-service></ejb-timer-service> | |
| 245 | + </ejb-container> | |
| 246 | + <mdb-container></mdb-container> | |
| 247 | + <jms-service addresslist-behavior="priority" default-jms-host="default_JMS_host"> | |
| 248 | + <jms-host port="${JMS_PROVIDER_PORT}" host="localhost" name="default_JMS_host"></jms-host> | |
| 249 | + </jms-service> | |
| 250 | + <log-service log-rotation-limit-in-bytes="2000000" file="${com.sun.aas.instanceRoot}/logs/server.log"> | |
| 251 | + <module-log-levels></module-log-levels> | |
| 252 | + </log-service> | |
| 253 | + <security-service> | |
| 254 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm"> | |
| 255 | + <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile"></property> | |
| 256 | + <property name="jaas-context" value="fileRealm"></property> | |
| 257 | + </auth-realm> | |
| 258 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file"> | |
| 259 | + <property name="file" value="src/test/resources/keyfile"></property> | |
| 260 | + <property name="jaas-context" value="fileRealm"></property> | |
| 261 | + </auth-realm> | |
| 262 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate"></auth-realm> | |
| 263 | + <jacc-provider policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default" policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl"> | |
| 264 | + <property name="repository" value="${com.sun.aas.instanceRoot}/generated/policy"></property> | |
| 265 | + </jacc-provider> | |
| 266 | + <jacc-provider policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory"></jacc-provider> | |
| 267 | + <audit-module classname="com.sun.enterprise.security.Audit" name="default"> | |
| 268 | + <property name="auditOn" value="false"></property> | |
| 269 | + </audit-module> | |
| 270 | + <message-security-config auth-layer="SOAP"> | |
| 271 | + <provider-config provider-type="client" provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule"> | |
| 272 | + <request-policy auth-source="content"></request-policy> | |
| 273 | + <response-policy auth-source="content"></response-policy> | |
| 274 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 275 | + <property name="signature.key.alias" value="s1as"></property> | |
| 276 | + <property name="dynamic.username.password" value="false"></property> | |
| 277 | + <property name="debug" value="false"></property> | |
| 278 | + </provider-config> | |
| 279 | + <provider-config provider-type="client" provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule"> | |
| 280 | + <request-policy auth-source="content"></request-policy> | |
| 281 | + <response-policy auth-source="content"></response-policy> | |
| 282 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 283 | + <property name="signature.key.alias" value="s1as"></property> | |
| 284 | + <property name="dynamic.username.password" value="false"></property> | |
| 285 | + <property name="debug" value="false"></property> | |
| 286 | + <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property> | |
| 287 | + </provider-config> | |
| 288 | + <provider-config provider-type="server" provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule"> | |
| 289 | + <request-policy auth-source="content"></request-policy> | |
| 290 | + <response-policy auth-source="content"></response-policy> | |
| 291 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 292 | + <property name="signature.key.alias" value="s1as"></property> | |
| 293 | + <property name="debug" value="false"></property> | |
| 294 | + </provider-config> | |
| 295 | + <provider-config provider-type="server" provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule"> | |
| 296 | + <request-policy auth-source="content"></request-policy> | |
| 297 | + <response-policy auth-source="content"></response-policy> | |
| 298 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 299 | + <property name="signature.key.alias" value="s1as"></property> | |
| 300 | + <property name="debug" value="false"></property> | |
| 301 | + <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property> | |
| 302 | + </provider-config> | |
| 303 | + </message-security-config> | |
| 304 | + </security-service> | |
| 305 | + <transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs" automatic-recovery="true"></transaction-service> | |
| 306 | + <diagnostic-service></diagnostic-service> | |
| 307 | + <java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUGGER_PORT}" system-classpath="" classpath-suffix=""> | |
| 308 | + <jvm-options>-XX:MaxPermSize=192m</jvm-options> | |
| 309 | + <jvm-options>-XX:PermSize=64m</jvm-options> | |
| 310 | + <jvm-options>-server</jvm-options> | |
| 311 | + <jvm-options>-Djava.awt.headless=true</jvm-options> | |
| 312 | + <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options> | |
| 313 | + <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options> | |
| 314 | + <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options> | |
| 315 | + <jvm-options>-Djava.security.auth.login.config=src/test/resources/login.conf</jvm-options> | |
| 316 | + <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options> | |
| 317 | + <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options> | |
| 318 | + <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options> | |
| 319 | + <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options> | |
| 320 | + <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options> | |
| 321 | + <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options> | |
| 322 | + <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options> | |
| 323 | + <jvm-options>-XX:NewRatio=2</jvm-options> | |
| 324 | + <jvm-options>-Xmx512m</jvm-options> | |
| 325 | + <jvm-options>-Dosgi.shell.telnet.port=${OSGI_SHELL_TELNET_PORT}</jvm-options> | |
| 326 | + <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options> | |
| 327 | + <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options> | |
| 328 | + <jvm-options>-Dgosh.args=--noshutdown -c noop=true</jvm-options> | |
| 329 | + <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options> | |
| 330 | + <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options> | |
| 331 | + <jvm-options>-Dfelix.fileinstall.log.level=3</jvm-options> | |
| 332 | + <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options> | |
| 333 | + <jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options> | |
| 334 | + <jvm-options>-Dfelix.fileinstall.disableConfigSave=false</jvm-options> | |
| 335 | + </java-config> | |
| 336 | + <availability-service> | |
| 337 | + <web-container-availability></web-container-availability> | |
| 338 | + <ejb-container-availability sfsb-store-pool-name="jdbc/hastore"></ejb-container-availability> | |
| 339 | + <jms-availability></jms-availability> | |
| 340 | + </availability-service> | |
| 341 | + <network-config> | |
| 342 | + <protocols> | |
| 343 | + <protocol name="http-listener-1"> | |
| 344 | + <http default-virtual-server="server"> | |
| 345 | + <file-cache></file-cache> | |
| 346 | + </http> | |
| 347 | + </protocol> | |
| 348 | + <protocol security-enabled="true" name="http-listener-2"> | |
| 349 | + <http default-virtual-server="server"> | |
| 350 | + <file-cache></file-cache> | |
| 351 | + </http> | |
| 352 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl> | |
| 353 | + </protocol> | |
| 354 | + <protocol name="admin-listener"> | |
| 355 | + <http default-virtual-server="__asadmin" max-connections="250"> | |
| 356 | + <file-cache></file-cache> | |
| 357 | + </http> | |
| 358 | + </protocol> | |
| 359 | + <protocol security-enabled="true" name="sec-admin-listener"> | |
| 360 | + <http default-virtual-server="__asadmin" encoded-slash-enabled="true"> | |
| 361 | + <file-cache></file-cache> | |
| 362 | + </http> | |
| 363 | + <ssl client-auth="want" classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="glassfish-instance"></ssl> | |
| 364 | + </protocol> | |
| 365 | + <protocol name="admin-http-redirect"> | |
| 366 | + <http-redirect secure="true"></http-redirect> | |
| 367 | + </protocol> | |
| 368 | + <protocol name="pu-protocol"> | |
| 369 | + <port-unification> | |
| 370 | + <protocol-finder protocol="sec-admin-listener" name="http-finder" classname="com.sun.grizzly.config.HttpProtocolFinder"></protocol-finder> | |
| 371 | + <protocol-finder protocol="admin-http-redirect" name="admin-http-redirect" classname="com.sun.grizzly.config.HttpProtocolFinder"></protocol-finder> | |
| 372 | + </port-unification> | |
| 373 | + </protocol> | |
| 374 | + </protocols> | |
| 375 | + <network-listeners> | |
| 376 | + <network-listener port="${HTTP_LISTENER_PORT}" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener> | |
| 377 | + <network-listener port="${HTTP_SSL_LISTENER_PORT}" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener> | |
| 378 | + <network-listener port="${ASADMIN_LISTENER_PORT}" protocol="pu-protocol" transport="tcp" name="admin-listener" thread-pool="http-thread-pool"></network-listener> | |
| 379 | + </network-listeners> | |
| 380 | + <transports> | |
| 381 | + <transport name="tcp"></transport> | |
| 382 | + </transports> | |
| 383 | + </network-config> | |
| 384 | + <thread-pools> | |
| 385 | + <thread-pool name="http-thread-pool"></thread-pool> | |
| 386 | + <thread-pool max-thread-pool-size="200" name="thread-pool-1"></thread-pool> | |
| 387 | + <thread-pool name="admin-thread-pool" max-thread-pool-size="50" max-queue-size="256"></thread-pool> | |
| 388 | + </thread-pools> | |
| 389 | + <group-management-service> | |
| 390 | + <failure-detection></failure-detection> | |
| 391 | + </group-management-service> | |
| 392 | + <management-rules></management-rules> | |
| 393 | + <system-property name="ASADMIN_LISTENER_PORT" value="24848"></system-property> | |
| 394 | + <system-property name="HTTP_LISTENER_PORT" value="28080"></system-property> | |
| 395 | + <system-property name="HTTP_SSL_LISTENER_PORT" value="28181"></system-property> | |
| 396 | + <system-property name="JMS_PROVIDER_PORT" value="27676"></system-property> | |
| 397 | + <system-property name="IIOP_LISTENER_PORT" value="23700"></system-property> | |
| 398 | + <system-property name="IIOP_SSL_LISTENER_PORT" value="23820"></system-property> | |
| 399 | + <system-property name="IIOP_SSL_MUTUALAUTH_PORT" value="23920"></system-property> | |
| 400 | + <system-property name="JMX_SYSTEM_CONNECTOR_PORT" value="28686"></system-property> | |
| 401 | + <system-property name="OSGI_SHELL_TELNET_PORT" value="26666"></system-property> | |
| 402 | + <system-property name="JAVA_DEBUGGER_PORT" value="29009"></system-property> | |
| 403 | + <monitoring-service> | |
| 404 | + <module-monitoring-levels></module-monitoring-levels> | |
| 405 | + </monitoring-service> | |
| 406 | + <connector-service></connector-service> | |
| 407 | + </config> | |
| 408 | + </configs> | |
| 409 | + <property name="administrative.domain.name" value="domain1"></property> | |
| 410 | + <secure-admin special-admin-indicator="e4a50521-0eca-4932-bca9-805fc1d8412e"> | |
| 411 | + <secure-admin-principal dn="CN=localhost,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US"></secure-admin-principal> | |
| 412 | + <secure-admin-principal dn="CN=localhost-instance,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US"></secure-admin-principal> | |
| 413 | + </secure-admin> | |
| 414 | + <load-balancers></load-balancers> | |
| 415 | + <lb-configs></lb-configs> | |
| 416 | + <clusters></clusters> | |
| 417 | +</domain> | |
| 0 | 418 | \ No newline at end of file | ... | ... |
impl/extension/rest/src/test/java/security/authentication/basic/BasicAuthenticationFilterTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,84 @@ |
| 1 | +package security.authentication.basic; | |
| 2 | + | |
| 3 | +import static org.apache.http.HttpStatus.SC_UNAUTHORIZED; | |
| 4 | +import static org.apache.http.HttpStatus.SC_FORBIDDEN; | |
| 5 | +import static org.apache.http.HttpStatus.SC_OK; | |
| 6 | +import static org.junit.Assert.assertEquals; | |
| 7 | + | |
| 8 | +import java.io.IOException; | |
| 9 | +import java.net.URL; | |
| 10 | + | |
| 11 | +import org.apache.commons.codec.binary.Base64; | |
| 12 | +import org.apache.http.HttpEntity; | |
| 13 | +import org.apache.http.HttpResponse; | |
| 14 | +import org.apache.http.client.ClientProtocolException; | |
| 15 | +import org.apache.http.client.methods.HttpGet; | |
| 16 | +import org.apache.http.client.methods.HttpPost; | |
| 17 | +import org.apache.http.impl.client.CloseableHttpClient; | |
| 18 | +import org.apache.http.impl.client.HttpClientBuilder; | |
| 19 | +import org.jboss.arquillian.container.test.api.Deployment; | |
| 20 | +import org.jboss.arquillian.junit.Arquillian; | |
| 21 | +import org.jboss.arquillian.test.api.ArquillianResource; | |
| 22 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | |
| 23 | +import org.junit.Test; | |
| 24 | +import org.junit.runner.RunWith; | |
| 25 | + | |
| 26 | +import test.Tests; | |
| 27 | + | |
| 28 | +@RunWith(Arquillian.class) | |
| 29 | +public class BasicAuthenticationFilterTest { | |
| 30 | + | |
| 31 | + private static final String PATH = "src/test/resources/security/authentication/basic"; | |
| 32 | + | |
| 33 | + @ArquillianResource | |
| 34 | + private URL deploymentUrl; | |
| 35 | + | |
| 36 | + @Deployment(testable = false) | |
| 37 | + public static WebArchive createDeployment() { | |
| 38 | + return Tests.createDeployment().addClasses(BasicAuthenticationFilterTest.class) | |
| 39 | + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Test | |
| 43 | + public void loginSucessfull() throws ClientProtocolException, IOException { | |
| 44 | + CloseableHttpClient client = HttpClientBuilder.create().build(); | |
| 45 | + HttpGet get; | |
| 46 | + HttpResponse response; | |
| 47 | + int status; | |
| 48 | + | |
| 49 | + String username = "demoiselle"; | |
| 50 | + String password = "changeit"; | |
| 51 | + get = new HttpGet(deploymentUrl + "/helper"); | |
| 52 | + byte[] encoded = Base64.encodeBase64((username + ":" + password).getBytes()); | |
| 53 | + get.setHeader("Authorization", "Basic " + new String(encoded)); | |
| 54 | + response = client.execute(get); | |
| 55 | + status = response.getStatusLine().getStatusCode(); | |
| 56 | + assertEquals(SC_OK, status); | |
| 57 | + | |
| 58 | + get = new HttpGet(deploymentUrl + "/helper"); | |
| 59 | + response = client.execute(get); | |
| 60 | + status = response.getStatusLine().getStatusCode(); | |
| 61 | + assertEquals(SC_FORBIDDEN, status); | |
| 62 | + } | |
| 63 | + | |
| 64 | + @Test | |
| 65 | + public void loginFailed() throws ClientProtocolException, IOException { | |
| 66 | + String username = "invalid"; | |
| 67 | + String password = "invalid"; | |
| 68 | + | |
| 69 | + | |
| 70 | + HttpPost x = new HttpPost(); | |
| 71 | + x.setEntity(null); | |
| 72 | + | |
| 73 | + //HttpEntity entity | |
| 74 | + | |
| 75 | + HttpGet get = new HttpGet(deploymentUrl + "/helper"); | |
| 76 | + byte[] encoded = Base64.encodeBase64((username + ":" + password).getBytes()); | |
| 77 | + get.setHeader("Authorization", "Basic " + new String(encoded)); | |
| 78 | + | |
| 79 | + HttpResponse response = HttpClientBuilder.create().build().execute(get); | |
| 80 | + | |
| 81 | + int status = response.getStatusLine().getStatusCode(); | |
| 82 | + assertEquals(SC_UNAUTHORIZED, status); | |
| 83 | + } | |
| 84 | +} | ... | ... |
impl/extension/rest/src/test/java/security/authentication/basic/HelperServlet.java
0 → 100644
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +package security.authentication.basic; | |
| 2 | + | |
| 3 | +import static org.apache.http.HttpStatus.SC_FORBIDDEN; | |
| 4 | +import static org.apache.http.HttpStatus.SC_OK; | |
| 5 | + | |
| 6 | +import java.io.IOException; | |
| 7 | + | |
| 8 | +import javax.servlet.ServletException; | |
| 9 | +import javax.servlet.http.HttpServlet; | |
| 10 | +import javax.servlet.http.HttpServletRequest; | |
| 11 | +import javax.servlet.http.HttpServletResponse; | |
| 12 | + | |
| 13 | +import br.gov.frameworkdemoiselle.security.SecurityContext; | |
| 14 | +import br.gov.frameworkdemoiselle.util.Beans; | |
| 15 | + | |
| 16 | +public class HelperServlet extends HttpServlet { | |
| 17 | + | |
| 18 | + private static final long serialVersionUID = 1L; | |
| 19 | + | |
| 20 | + @Override | |
| 21 | + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
| 22 | + boolean loggedIn = Beans.getReference(SecurityContext.class).isLoggedIn(); | |
| 23 | + | |
| 24 | + if (loggedIn) { | |
| 25 | + response.setStatus(SC_OK); | |
| 26 | + } else { | |
| 27 | + response.setStatus(SC_FORBIDDEN); | |
| 28 | + } | |
| 29 | + } | |
| 30 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,118 @@ |
| 1 | +/* | |
| 2 | + * Demoiselle Framework | |
| 3 | + * Copyright (C) 2010 SERPRO | |
| 4 | + * ---------------------------------------------------------------------------- | |
| 5 | + * This file is part of Demoiselle Framework. | |
| 6 | + * | |
| 7 | + * Demoiselle Framework is free software; you can redistribute it and/or | |
| 8 | + * modify it under the terms of the GNU Lesser General Public License version 3 | |
| 9 | + * as published by the Free Software Foundation. | |
| 10 | + * | |
| 11 | + * This program is distributed in the hope that it will be useful, | |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | + * GNU General Public License for more details. | |
| 15 | + * | |
| 16 | + * You should have received a copy of the GNU Lesser General Public License version 3 | |
| 17 | + * along with this program; if not, see <http://www.gnu.org/licenses/> | |
| 18 | + * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
| 19 | + * Fifth Floor, Boston, MA 02110-1301, USA. | |
| 20 | + * ---------------------------------------------------------------------------- | |
| 21 | + * Este arquivo é parte do Framework Demoiselle. | |
| 22 | + * | |
| 23 | + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
| 24 | + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
| 25 | + * do Software Livre (FSF). | |
| 26 | + * | |
| 27 | + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
| 28 | + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
| 29 | + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
| 30 | + * para maiores detalhes. | |
| 31 | + * | |
| 32 | + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
| 33 | + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
| 34 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
| 35 | + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
| 36 | + */ | |
| 37 | +package test; | |
| 38 | + | |
| 39 | +import java.io.File; | |
| 40 | + | |
| 41 | +import org.jboss.shrinkwrap.api.ShrinkWrap; | |
| 42 | +import org.jboss.shrinkwrap.api.asset.FileAsset; | |
| 43 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | |
| 44 | +import org.jboss.shrinkwrap.resolver.api.maven.Maven; | |
| 45 | +import org.junit.Ignore; | |
| 46 | + | |
| 47 | +import br.gov.frameworkdemoiselle.BadRequestException; | |
| 48 | +import br.gov.frameworkdemoiselle.ForbiddenException; | |
| 49 | +import br.gov.frameworkdemoiselle.HttpViolationException; | |
| 50 | +import br.gov.frameworkdemoiselle.InternalServerErrorException; | |
| 51 | +import br.gov.frameworkdemoiselle.NotFoundException; | |
| 52 | +import br.gov.frameworkdemoiselle.ServiceUnavailableException; | |
| 53 | +import br.gov.frameworkdemoiselle.UnprocessableEntityException; | |
| 54 | +import br.gov.frameworkdemoiselle.internal.implementation.AuthenticationExceptionMapper; | |
| 55 | +import br.gov.frameworkdemoiselle.internal.implementation.AuthorizationExceptionMapper; | |
| 56 | +import br.gov.frameworkdemoiselle.internal.implementation.ConstraintViolationExceptionMapper; | |
| 57 | +import br.gov.frameworkdemoiselle.internal.implementation.DefaultExceptionMapper; | |
| 58 | +import br.gov.frameworkdemoiselle.internal.implementation.HttpViolationExceptionMapper; | |
| 59 | +import br.gov.frameworkdemoiselle.internal.implementation.NotLoggedInExceptionMapper; | |
| 60 | +import br.gov.frameworkdemoiselle.internal.implementation.SessionNotPermittedListener; | |
| 61 | +import br.gov.frameworkdemoiselle.security.AbstractHTTPAuthorizationFilter; | |
| 62 | +import br.gov.frameworkdemoiselle.security.BasicAuthFilter; | |
| 63 | +import br.gov.frameworkdemoiselle.security.RESTSecurityConfig; | |
| 64 | +import br.gov.frameworkdemoiselle.security.Token; | |
| 65 | +//import br.gov.frameworkdemoiselle.util.BasicAuthFilter; | |
| 66 | +import br.gov.frameworkdemoiselle.security.TokenAuthFilter; | |
| 67 | +import br.gov.frameworkdemoiselle.util.Rests; | |
| 68 | +import br.gov.frameworkdemoiselle.util.ValidatePayload; | |
| 69 | +import br.gov.frameworkdemoiselle.util.ValidatePayloadInterceptor; | |
| 70 | + | |
| 71 | +@Ignore | |
| 72 | +public final class Tests { | |
| 73 | + | |
| 74 | + private Tests() { | |
| 75 | + } | |
| 76 | + | |
| 77 | + public static WebArchive createDeployment(final Class<?> baseClass) { | |
| 78 | + return createDeployment().addPackages(true, baseClass.getPackage()).addClass(Tests.class); | |
| 79 | + } | |
| 80 | + | |
| 81 | + public static WebArchive createDeployment() { | |
| 82 | + File[] libs = Maven.resolver().offline().loadPomFromFile("pom.xml", "arquillian-test") | |
| 83 | + .importCompileAndRuntimeDependencies().resolve().withTransitivity().asFile(); | |
| 84 | + | |
| 85 | + return ShrinkWrap | |
| 86 | + .create(WebArchive.class) | |
| 87 | + .addClass(BadRequestException.class) | |
| 88 | + .addClass(ForbiddenException.class) | |
| 89 | + .addClass(HttpViolationException.class) | |
| 90 | + .addClass(InternalServerErrorException.class) | |
| 91 | + .addClass(NotFoundException.class) | |
| 92 | + .addClass(ServiceUnavailableException.class) | |
| 93 | + .addClass(UnprocessableEntityException.class) | |
| 94 | + .addClass(AuthenticationExceptionMapper.class) | |
| 95 | + .addClass(AuthorizationExceptionMapper.class) | |
| 96 | + .addClass(ConstraintViolationExceptionMapper.class) | |
| 97 | + .addClass(DefaultExceptionMapper.class) | |
| 98 | + .addClass(HttpViolationExceptionMapper.class) | |
| 99 | + .addClass(NotLoggedInExceptionMapper.class) | |
| 100 | + .addClass(SessionNotPermittedListener.class) | |
| 101 | + .addClass(AbstractHTTPAuthorizationFilter.class) | |
| 102 | + .addClass(BasicAuthFilter.class) | |
| 103 | + .addClass(RESTSecurityConfig.class) | |
| 104 | + .addClass(Token.class) | |
| 105 | + .addClass(TokenAuthFilter.class) | |
| 106 | + .addClass(Rests.class) | |
| 107 | + .addClass(ValidatePayload.class) | |
| 108 | + .addClass(ValidatePayloadInterceptor.class) | |
| 109 | + .addAsResource(createFileAsset("src/main/resources/demoiselle-rest-bundle.properties"), | |
| 110 | + "demoiselle-rest-bundle.properties") | |
| 111 | + .addAsWebInfResource(createFileAsset("src/test/resources/test/beans.xml"), "beans.xml") | |
| 112 | + .addAsLibraries(libs); | |
| 113 | + } | |
| 114 | + | |
| 115 | + public static FileAsset createFileAsset(final String pathname) { | |
| 116 | + return new FileAsset(new File(pathname)); | |
| 117 | + } | |
| 118 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,61 @@ |
| 1 | +/* | |
| 2 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
| 3 | + * | |
| 4 | + * Copyright (c) 2004-2010 Oracle and/or its affiliates. All rights reserved. | |
| 5 | + * | |
| 6 | + * The contents of this file are subject to the terms of either the GNU | |
| 7 | + * General Public License Version 2 only ("GPL") or the Common Development | |
| 8 | + * and Distribution License("CDDL") (collectively, the "License"). You | |
| 9 | + * may not use this file except in compliance with the License. You can | |
| 10 | + * obtain a copy of the License at | |
| 11 | + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html | |
| 12 | + * or packager/legal/LICENSE.txt. See the License for the specific | |
| 13 | + * language governing permissions and limitations under the License. | |
| 14 | + * | |
| 15 | + * When distributing the software, include this License Header Notice in each | |
| 16 | + * file and include the License file at packager/legal/LICENSE.txt. | |
| 17 | + * | |
| 18 | + * GPL Classpath Exception: | |
| 19 | + * Oracle designates this particular file as subject to the "Classpath" | |
| 20 | + * exception as provided by Oracle in the GPL Version 2 section of the License | |
| 21 | + * file that accompanied this code. | |
| 22 | + * | |
| 23 | + * Modifications: | |
| 24 | + * If applicable, add the following below the License Header, with the fields | |
| 25 | + * enclosed by brackets [] replaced by your own identifying information: | |
| 26 | + * "Portions Copyright [year] [name of copyright owner]" | |
| 27 | + * | |
| 28 | + * Contributor(s): | |
| 29 | + * If you wish your version of this file to be governed by only the CDDL or | |
| 30 | + * only the GPL Version 2, indicate your decision by adding "[Contributor] | |
| 31 | + * elects to include this software in this distribution under the [CDDL or GPL | |
| 32 | + * Version 2] license." If you don't indicate a single choice of license, a | |
| 33 | + * recipient has the option to distribute your version of this file under | |
| 34 | + * either the CDDL, the GPL Version 2 or to extend the choice of license to | |
| 35 | + * its licensees as provided above. However, if you add GPL Version 2 code | |
| 36 | + * and therefore, elected the GPL Version 2 license, then the option applies | |
| 37 | + * only if the new code is made subject to such option by the copyright | |
| 38 | + * holder. | |
| 39 | + */ | |
| 40 | + | |
| 41 | +fileRealm { | |
| 42 | + com.sun.enterprise.security.auth.login.FileLoginModule required; | |
| 43 | +}; | |
| 44 | + | |
| 45 | +ldapRealm { | |
| 46 | + com.sun.enterprise.security.auth.login.LDAPLoginModule required; | |
| 47 | +}; | |
| 48 | + | |
| 49 | +solarisRealm { | |
| 50 | + com.sun.enterprise.security.auth.login.SolarisLoginModule required; | |
| 51 | +}; | |
| 52 | + | |
| 53 | +jdbcRealm { | |
| 54 | + com.sun.enterprise.security.auth.login.JDBCLoginModule required; | |
| 55 | +}; | |
| 56 | +jdbcDigestRealm { | |
| 57 | + com.sun.enterprise.security.auth.login.JDBCDigestLoginModule required; | |
| 58 | +}; | |
| 59 | +pamRealm { | |
| 60 | + com.sun.enterprise.security.auth.login.PamLoginModule required; | |
| 61 | +}; | ... | ... |
| ... | ... | @@ -0,0 +1,66 @@ |
| 1 | +<!-- | |
| 2 | + Demoiselle Framework | |
| 3 | + Copyright (C) 2010 SERPRO | |
| 4 | + ============================================================================ | |
| 5 | + This file is part of Demoiselle Framework. | |
| 6 | + | |
| 7 | + Demoiselle Framework is free software; you can redistribute it and/or | |
| 8 | + modify it under the terms of the GNU Lesser General Public License version 3 | |
| 9 | + as published by the Free Software Foundation. | |
| 10 | + | |
| 11 | + This program is distributed in the hope that it will be useful, | |
| 12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | + GNU General Public License for more details. | |
| 15 | + | |
| 16 | + You should have received a copy of the GNU Lesser General Public License version 3 | |
| 17 | + along with this program; if not, see <http://www.gnu.org/licenses /> | |
| 18 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
| 19 | + Fifth Floor, Boston, MA 02110-1301, USA. | |
| 20 | + ============================================================================ | |
| 21 | + Este arquivo é parte do Framework Demoiselle. | |
| 22 | + | |
| 23 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
| 24 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
| 25 | + do Software Livre (FSF). | |
| 26 | + | |
| 27 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
| 28 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
| 29 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
| 30 | + para maiores detalhes. | |
| 31 | + | |
| 32 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
| 33 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses /> | |
| 34 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | |
| 35 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
| 36 | +--> | |
| 37 | +<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 38 | + xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> | |
| 39 | + | |
| 40 | + <!-- | |
| 41 | + --> | |
| 42 | + <engine> | |
| 43 | + <property name="deploymentExportPath">target/deployments</property> | |
| 44 | + </engine> | |
| 45 | + | |
| 46 | + <!-- | |
| 47 | + <extension qualifier="selenium"> | |
| 48 | + <property name="browser">*googlechrome</property> | |
| 49 | + </extension> | |
| 50 | + --> | |
| 51 | + | |
| 52 | + <container qualifier="glassfish-embedded" default="true"> | |
| 53 | + <configuration> | |
| 54 | + <property name="configurationXml">src/test/resources/domain.xml</property> | |
| 55 | + </configuration> | |
| 56 | + </container> | |
| 57 | + | |
| 58 | + <!-- | |
| 59 | + <container qualifier="jbossas-managed" default="true"> | |
| 60 | + <protocol type="Servlet 3.0" /> | |
| 61 | + <configuration> | |
| 62 | + <property name="jbossHome">target/jboss-as-${jboss.as.version}</property> | |
| 63 | + </configuration> | |
| 64 | + </container> | |
| 65 | + --> | |
| 66 | +</arquillian> | ... | ... |
| ... | ... | @@ -0,0 +1,417 @@ |
| 1 | +<domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" version="23"> | |
| 2 | + <system-applications> | |
| 3 | + <application context-root="" location="${com.sun.aas.installRootURI}/lib/install/applications/__admingui" name="__admingui" directory-deployed="true" object-type="system-admin"> | |
| 4 | + <module name="__admingui"> | |
| 5 | + <engine sniffer="web"></engine> | |
| 6 | + <engine sniffer="security"></engine> | |
| 7 | + </module> | |
| 8 | + </application> | |
| 9 | + </system-applications> | |
| 10 | + <applications></applications> | |
| 11 | + <resources> | |
| 12 | + <jdbc-resource pool-name="__TimerPool" jndi-name="jdbc/__TimerPool" object-type="system-admin"></jdbc-resource> | |
| 13 | + <jdbc-resource pool-name="DerbyPool" jndi-name="jdbc/__default"></jdbc-resource> | |
| 14 | + <jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource" name="__TimerPool"> | |
| 15 | + <property name="databaseName" value="${com.sun.aas.instanceRoot}/lib/databases/ejbtimer"></property> | |
| 16 | + <property name="connectionAttributes" value=";create=true"></property> | |
| 17 | + </jdbc-connection-pool> | |
| 18 | + <jdbc-connection-pool is-isolation-level-guaranteed="false" datasource-classname="org.apache.derby.jdbc.ClientDataSource" res-type="javax.sql.DataSource" name="DerbyPool"> | |
| 19 | + <property name="PortNumber" value="1527"></property> | |
| 20 | + <property name="Password" value="APP"></property> | |
| 21 | + <property name="User" value="APP"></property> | |
| 22 | + <property name="serverName" value="localhost"></property> | |
| 23 | + <property name="DatabaseName" value="sun-appserv-samples"></property> | |
| 24 | + <property name="connectionAttributes" value=";create=true"></property> | |
| 25 | + </jdbc-connection-pool> | |
| 26 | + </resources> | |
| 27 | + <servers> | |
| 28 | + <server name="server" config-ref="server-config"> | |
| 29 | + <application-ref ref="__admingui" virtual-servers="__asadmin"></application-ref> | |
| 30 | + <resource-ref ref="jdbc/__TimerPool"></resource-ref> | |
| 31 | + <resource-ref ref="jdbc/__default"></resource-ref> | |
| 32 | + </server> | |
| 33 | + </servers> | |
| 34 | + <nodes> | |
| 35 | + <node node-host="localhost" name="localhost-domain1" type="CONFIG" install-dir="${com.sun.aas.productRoot}"></node> | |
| 36 | + </nodes> | |
| 37 | + <configs> | |
| 38 | + <config name="server-config"> | |
| 39 | + <http-service> | |
| 40 | + <access-log></access-log> | |
| 41 | + <virtual-server id="server" network-listeners="http-listener-1,http-listener-2"></virtual-server> | |
| 42 | + <virtual-server id="__asadmin" network-listeners="admin-listener"></virtual-server> | |
| 43 | + </http-service> | |
| 44 | + <iiop-service> | |
| 45 | + <orb use-thread-pool-ids="thread-pool-1"></orb> | |
| 46 | + <iiop-listener port="3700" id="orb-listener-1" address="0.0.0.0" lazy-init="true"></iiop-listener> | |
| 47 | + <iiop-listener port="3820" id="SSL" address="0.0.0.0" security-enabled="true"> | |
| 48 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl> | |
| 49 | + </iiop-listener> | |
| 50 | + <iiop-listener port="3920" id="SSL_MUTUALAUTH" address="0.0.0.0" security-enabled="true"> | |
| 51 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as" client-auth-enabled="true"></ssl> | |
| 52 | + </iiop-listener> | |
| 53 | + </iiop-service> | |
| 54 | + <admin-service system-jmx-connector-name="system" type="das-and-server"> | |
| 55 | + <jmx-connector port="8686" address="0.0.0.0" security-enabled="false" auth-realm-name="admin-realm" name="system"></jmx-connector> | |
| 56 | + <property name="adminConsoleContextRoot" value="/admin"></property> | |
| 57 | + <property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war"></property> | |
| 58 | + <property name="ipsRoot" value="${com.sun.aas.installRoot}/.."></property> | |
| 59 | + <das-config></das-config> | |
| 60 | + </admin-service> | |
| 61 | + <connector-service></connector-service> | |
| 62 | + <web-container> | |
| 63 | + <session-config> | |
| 64 | + <session-manager> | |
| 65 | + <manager-properties></manager-properties> | |
| 66 | + <store-properties></store-properties> | |
| 67 | + </session-manager> | |
| 68 | + <session-properties></session-properties> | |
| 69 | + </session-config> | |
| 70 | + </web-container> | |
| 71 | + <ejb-container session-store="${com.sun.aas.instanceRoot}/session-store"> | |
| 72 | + <ejb-timer-service></ejb-timer-service> | |
| 73 | + </ejb-container> | |
| 74 | + <mdb-container></mdb-container> | |
| 75 | + <jms-service default-jms-host="default_JMS_host"> | |
| 76 | + <jms-host host="localhost" name="default_JMS_host"></jms-host> | |
| 77 | + </jms-service> | |
| 78 | + <security-service> | |
| 79 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm"> | |
| 80 | + <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile"></property> | |
| 81 | + <property name="jaas-context" value="fileRealm"></property> | |
| 82 | + </auth-realm> | |
| 83 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file"> | |
| 84 | + <property name="file" value="src/test/resources/keyfile"></property> | |
| 85 | + <property name="jaas-context" value="fileRealm"></property> | |
| 86 | + </auth-realm> | |
| 87 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate"></auth-realm> | |
| 88 | + <jacc-provider policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default" policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl"> | |
| 89 | + <property name="repository" value="${com.sun.aas.instanceRoot}/generated/policy"></property> | |
| 90 | + </jacc-provider> | |
| 91 | + <jacc-provider policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory"></jacc-provider> | |
| 92 | + <audit-module classname="com.sun.enterprise.security.Audit" name="default"> | |
| 93 | + <property name="auditOn" value="false"></property> | |
| 94 | + </audit-module> | |
| 95 | + <message-security-config auth-layer="SOAP"> | |
| 96 | + <provider-config provider-type="client" provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule"> | |
| 97 | + <request-policy auth-source="content"></request-policy> | |
| 98 | + <response-policy auth-source="content"></response-policy> | |
| 99 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 100 | + <property name="signature.key.alias" value="s1as"></property> | |
| 101 | + <property name="dynamic.username.password" value="false"></property> | |
| 102 | + <property name="debug" value="false"></property> | |
| 103 | + </provider-config> | |
| 104 | + <provider-config provider-type="client" provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule"> | |
| 105 | + <request-policy auth-source="content"></request-policy> | |
| 106 | + <response-policy auth-source="content"></response-policy> | |
| 107 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 108 | + <property name="signature.key.alias" value="s1as"></property> | |
| 109 | + <property name="dynamic.username.password" value="false"></property> | |
| 110 | + <property name="debug" value="false"></property> | |
| 111 | + <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property> | |
| 112 | + </provider-config> | |
| 113 | + <provider-config provider-type="server" provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule"> | |
| 114 | + <request-policy auth-source="content"></request-policy> | |
| 115 | + <response-policy auth-source="content"></response-policy> | |
| 116 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 117 | + <property name="signature.key.alias" value="s1as"></property> | |
| 118 | + <property name="debug" value="false"></property> | |
| 119 | + </provider-config> | |
| 120 | + <provider-config provider-type="server" provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule"> | |
| 121 | + <request-policy auth-source="content"></request-policy> | |
| 122 | + <response-policy auth-source="content"></response-policy> | |
| 123 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 124 | + <property name="signature.key.alias" value="s1as"></property> | |
| 125 | + <property name="debug" value="false"></property> | |
| 126 | + <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property> | |
| 127 | + </provider-config> | |
| 128 | + </message-security-config> | |
| 129 | + <message-security-config auth-layer="HttpServlet"> | |
| 130 | + <provider-config provider-type="server" provider-id="GFConsoleAuthModule" class-name="org.glassfish.admingui.common.security.AdminConsoleAuthModule"> | |
| 131 | + <request-policy auth-source="sender"></request-policy> | |
| 132 | + <response-policy></response-policy> | |
| 133 | + <property name="restAuthURL" value="http://localhost:${ADMIN_LISTENER_PORT}/management/sessions"></property> | |
| 134 | + <property name="loginPage" value="/login.jsf"></property> | |
| 135 | + <property name="loginErrorPage" value="/loginError.jsf"></property> | |
| 136 | + </provider-config> | |
| 137 | + </message-security-config> | |
| 138 | + <property name="default-digest-algorithm" value="SHA-256"></property> | |
| 139 | + </security-service> | |
| 140 | + <transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs"></transaction-service> | |
| 141 | + <java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009" system-classpath="" classpath-suffix=""> | |
| 142 | + <jvm-options>-XX:MaxPermSize=192m</jvm-options> | |
| 143 | + <jvm-options>-XX:PermSize=64m</jvm-options> | |
| 144 | + <jvm-options>-client</jvm-options> | |
| 145 | + <jvm-options>-Djava.awt.headless=true</jvm-options> | |
| 146 | + <jvm-options>-Djavax.management.builder.initial=com.sun.enterprise.v3.admin.AppServerMBeanServerBuilder</jvm-options> | |
| 147 | + <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options> | |
| 148 | + <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options> | |
| 149 | + <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options> | |
| 150 | + <jvm-options>-Djava.security.auth.login.config=src/test/resources/login.conf</jvm-options> | |
| 151 | + <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options> | |
| 152 | + <jvm-options>-Xmx512m</jvm-options> | |
| 153 | + <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options> | |
| 154 | + <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options> | |
| 155 | + <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options> | |
| 156 | + <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options> | |
| 157 | + <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options> | |
| 158 | + <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options> | |
| 159 | + <jvm-options>-Dosgi.shell.telnet.port=6666</jvm-options> | |
| 160 | + <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options> | |
| 161 | + <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options> | |
| 162 | + <jvm-options>-Dgosh.args=--nointeractive</jvm-options> | |
| 163 | + <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options> | |
| 164 | + <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options> | |
| 165 | + <jvm-options>-Dfelix.fileinstall.log.level=2</jvm-options> | |
| 166 | + <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options> | |
| 167 | + <jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options> | |
| 168 | + <jvm-options>-Dfelix.fileinstall.disableConfigSave=false</jvm-options> | |
| 169 | + <jvm-options>-XX:NewRatio=2</jvm-options> | |
| 170 | + </java-config> | |
| 171 | + <network-config> | |
| 172 | + <protocols> | |
| 173 | + <protocol name="http-listener-1"> | |
| 174 | + <http default-virtual-server="server" max-connections="250"> | |
| 175 | + <file-cache></file-cache> | |
| 176 | + </http> | |
| 177 | + </protocol> | |
| 178 | + <protocol security-enabled="true" name="http-listener-2"> | |
| 179 | + <http default-virtual-server="server" max-connections="250"> | |
| 180 | + <file-cache></file-cache> | |
| 181 | + </http> | |
| 182 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl> | |
| 183 | + </protocol> | |
| 184 | + <protocol name="admin-listener"> | |
| 185 | + <http default-virtual-server="__asadmin" max-connections="250" encoded-slash-enabled="true"> | |
| 186 | + <file-cache></file-cache> | |
| 187 | + </http> | |
| 188 | + </protocol> | |
| 189 | + </protocols> | |
| 190 | + <network-listeners> | |
| 191 | + <network-listener port="8080" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener> | |
| 192 | + <network-listener port="8181" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener> | |
| 193 | + <network-listener port="4848" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="admin-thread-pool"></network-listener> | |
| 194 | + </network-listeners> | |
| 195 | + <transports> | |
| 196 | + <transport name="tcp"></transport> | |
| 197 | + </transports> | |
| 198 | + </network-config> | |
| 199 | + <thread-pools> | |
| 200 | + <thread-pool name="admin-thread-pool" max-thread-pool-size="50" max-queue-size="256"></thread-pool> | |
| 201 | + <thread-pool name="http-thread-pool"></thread-pool> | |
| 202 | + <thread-pool name="thread-pool-1" max-thread-pool-size="200"></thread-pool> | |
| 203 | + </thread-pools> | |
| 204 | + <monitoring-service> | |
| 205 | + <module-monitoring-levels></module-monitoring-levels> | |
| 206 | + </monitoring-service> | |
| 207 | + <group-management-service> | |
| 208 | + <failure-detection></failure-detection> | |
| 209 | + </group-management-service> | |
| 210 | + </config> | |
| 211 | + <config name="default-config"> | |
| 212 | + <http-service> | |
| 213 | + <access-log></access-log> | |
| 214 | + <virtual-server id="server" network-listeners="http-listener-1, http-listener-2"> | |
| 215 | + <property name="default-web-xml" value="${com.sun.aas.instanceRoot}/config/default-web.xml"></property> | |
| 216 | + </virtual-server> | |
| 217 | + <virtual-server id="__asadmin" network-listeners="admin-listener"></virtual-server> | |
| 218 | + </http-service> | |
| 219 | + <iiop-service> | |
| 220 | + <orb use-thread-pool-ids="thread-pool-1"></orb> | |
| 221 | + <iiop-listener port="${IIOP_LISTENER_PORT}" id="orb-listener-1" address="0.0.0.0"></iiop-listener> | |
| 222 | + <iiop-listener port="${IIOP_SSL_LISTENER_PORT}" id="SSL" address="0.0.0.0" security-enabled="true"> | |
| 223 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl> | |
| 224 | + </iiop-listener> | |
| 225 | + <iiop-listener port="${IIOP_SSL_MUTUALAUTH_PORT}" id="SSL_MUTUALAUTH" address="0.0.0.0" security-enabled="true"> | |
| 226 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as" client-auth-enabled="true"></ssl> | |
| 227 | + </iiop-listener> | |
| 228 | + </iiop-service> | |
| 229 | + <admin-service system-jmx-connector-name="system"> | |
| 230 | + <jmx-connector port="${JMX_SYSTEM_CONNECTOR_PORT}" address="0.0.0.0" security-enabled="false" auth-realm-name="admin-realm" name="system"></jmx-connector> | |
| 231 | + <property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war"></property> | |
| 232 | + <das-config></das-config> | |
| 233 | + </admin-service> | |
| 234 | + <web-container> | |
| 235 | + <session-config> | |
| 236 | + <session-manager> | |
| 237 | + <manager-properties></manager-properties> | |
| 238 | + <store-properties></store-properties> | |
| 239 | + </session-manager> | |
| 240 | + <session-properties></session-properties> | |
| 241 | + </session-config> | |
| 242 | + </web-container> | |
| 243 | + <ejb-container session-store="${com.sun.aas.instanceRoot}/session-store"> | |
| 244 | + <ejb-timer-service></ejb-timer-service> | |
| 245 | + </ejb-container> | |
| 246 | + <mdb-container></mdb-container> | |
| 247 | + <jms-service addresslist-behavior="priority" default-jms-host="default_JMS_host"> | |
| 248 | + <jms-host port="${JMS_PROVIDER_PORT}" host="localhost" name="default_JMS_host"></jms-host> | |
| 249 | + </jms-service> | |
| 250 | + <log-service log-rotation-limit-in-bytes="2000000" file="${com.sun.aas.instanceRoot}/logs/server.log"> | |
| 251 | + <module-log-levels></module-log-levels> | |
| 252 | + </log-service> | |
| 253 | + <security-service> | |
| 254 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm"> | |
| 255 | + <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile"></property> | |
| 256 | + <property name="jaas-context" value="fileRealm"></property> | |
| 257 | + </auth-realm> | |
| 258 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file"> | |
| 259 | + <property name="file" value="src/test/resources/keyfile"></property> | |
| 260 | + <property name="jaas-context" value="fileRealm"></property> | |
| 261 | + </auth-realm> | |
| 262 | + <auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate"></auth-realm> | |
| 263 | + <jacc-provider policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default" policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl"> | |
| 264 | + <property name="repository" value="${com.sun.aas.instanceRoot}/generated/policy"></property> | |
| 265 | + </jacc-provider> | |
| 266 | + <jacc-provider policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory"></jacc-provider> | |
| 267 | + <audit-module classname="com.sun.enterprise.security.Audit" name="default"> | |
| 268 | + <property name="auditOn" value="false"></property> | |
| 269 | + </audit-module> | |
| 270 | + <message-security-config auth-layer="SOAP"> | |
| 271 | + <provider-config provider-type="client" provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule"> | |
| 272 | + <request-policy auth-source="content"></request-policy> | |
| 273 | + <response-policy auth-source="content"></response-policy> | |
| 274 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 275 | + <property name="signature.key.alias" value="s1as"></property> | |
| 276 | + <property name="dynamic.username.password" value="false"></property> | |
| 277 | + <property name="debug" value="false"></property> | |
| 278 | + </provider-config> | |
| 279 | + <provider-config provider-type="client" provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule"> | |
| 280 | + <request-policy auth-source="content"></request-policy> | |
| 281 | + <response-policy auth-source="content"></response-policy> | |
| 282 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 283 | + <property name="signature.key.alias" value="s1as"></property> | |
| 284 | + <property name="dynamic.username.password" value="false"></property> | |
| 285 | + <property name="debug" value="false"></property> | |
| 286 | + <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property> | |
| 287 | + </provider-config> | |
| 288 | + <provider-config provider-type="server" provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule"> | |
| 289 | + <request-policy auth-source="content"></request-policy> | |
| 290 | + <response-policy auth-source="content"></response-policy> | |
| 291 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 292 | + <property name="signature.key.alias" value="s1as"></property> | |
| 293 | + <property name="debug" value="false"></property> | |
| 294 | + </provider-config> | |
| 295 | + <provider-config provider-type="server" provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule"> | |
| 296 | + <request-policy auth-source="content"></request-policy> | |
| 297 | + <response-policy auth-source="content"></response-policy> | |
| 298 | + <property name="encryption.key.alias" value="s1as"></property> | |
| 299 | + <property name="signature.key.alias" value="s1as"></property> | |
| 300 | + <property name="debug" value="false"></property> | |
| 301 | + <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property> | |
| 302 | + </provider-config> | |
| 303 | + </message-security-config> | |
| 304 | + </security-service> | |
| 305 | + <transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs" automatic-recovery="true"></transaction-service> | |
| 306 | + <diagnostic-service></diagnostic-service> | |
| 307 | + <java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUGGER_PORT}" system-classpath="" classpath-suffix=""> | |
| 308 | + <jvm-options>-XX:MaxPermSize=192m</jvm-options> | |
| 309 | + <jvm-options>-XX:PermSize=64m</jvm-options> | |
| 310 | + <jvm-options>-server</jvm-options> | |
| 311 | + <jvm-options>-Djava.awt.headless=true</jvm-options> | |
| 312 | + <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options> | |
| 313 | + <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options> | |
| 314 | + <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options> | |
| 315 | + <jvm-options>-Djava.security.auth.login.config=src/test/resources/login.conf</jvm-options> | |
| 316 | + <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options> | |
| 317 | + <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options> | |
| 318 | + <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options> | |
| 319 | + <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options> | |
| 320 | + <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options> | |
| 321 | + <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options> | |
| 322 | + <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options> | |
| 323 | + <jvm-options>-XX:NewRatio=2</jvm-options> | |
| 324 | + <jvm-options>-Xmx512m</jvm-options> | |
| 325 | + <jvm-options>-Dosgi.shell.telnet.port=${OSGI_SHELL_TELNET_PORT}</jvm-options> | |
| 326 | + <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options> | |
| 327 | + <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options> | |
| 328 | + <jvm-options>-Dgosh.args=--noshutdown -c noop=true</jvm-options> | |
| 329 | + <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options> | |
| 330 | + <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options> | |
| 331 | + <jvm-options>-Dfelix.fileinstall.log.level=3</jvm-options> | |
| 332 | + <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options> | |
| 333 | + <jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options> | |
| 334 | + <jvm-options>-Dfelix.fileinstall.disableConfigSave=false</jvm-options> | |
| 335 | + </java-config> | |
| 336 | + <availability-service> | |
| 337 | + <web-container-availability></web-container-availability> | |
| 338 | + <ejb-container-availability sfsb-store-pool-name="jdbc/hastore"></ejb-container-availability> | |
| 339 | + <jms-availability></jms-availability> | |
| 340 | + </availability-service> | |
| 341 | + <network-config> | |
| 342 | + <protocols> | |
| 343 | + <protocol name="http-listener-1"> | |
| 344 | + <http default-virtual-server="server"> | |
| 345 | + <file-cache></file-cache> | |
| 346 | + </http> | |
| 347 | + </protocol> | |
| 348 | + <protocol security-enabled="true" name="http-listener-2"> | |
| 349 | + <http default-virtual-server="server"> | |
| 350 | + <file-cache></file-cache> | |
| 351 | + </http> | |
| 352 | + <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl> | |
| 353 | + </protocol> | |
| 354 | + <protocol name="admin-listener"> | |
| 355 | + <http default-virtual-server="__asadmin" max-connections="250"> | |
| 356 | + <file-cache></file-cache> | |
| 357 | + </http> | |
| 358 | + </protocol> | |
| 359 | + <protocol security-enabled="true" name="sec-admin-listener"> | |
| 360 | + <http default-virtual-server="__asadmin" encoded-slash-enabled="true"> | |
| 361 | + <file-cache></file-cache> | |
| 362 | + </http> | |
| 363 | + <ssl client-auth="want" classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="glassfish-instance"></ssl> | |
| 364 | + </protocol> | |
| 365 | + <protocol name="admin-http-redirect"> | |
| 366 | + <http-redirect secure="true"></http-redirect> | |
| 367 | + </protocol> | |
| 368 | + <protocol name="pu-protocol"> | |
| 369 | + <port-unification> | |
| 370 | + <protocol-finder protocol="sec-admin-listener" name="http-finder" classname="com.sun.grizzly.config.HttpProtocolFinder"></protocol-finder> | |
| 371 | + <protocol-finder protocol="admin-http-redirect" name="admin-http-redirect" classname="com.sun.grizzly.config.HttpProtocolFinder"></protocol-finder> | |
| 372 | + </port-unification> | |
| 373 | + </protocol> | |
| 374 | + </protocols> | |
| 375 | + <network-listeners> | |
| 376 | + <network-listener port="${HTTP_LISTENER_PORT}" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener> | |
| 377 | + <network-listener port="${HTTP_SSL_LISTENER_PORT}" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener> | |
| 378 | + <network-listener port="${ASADMIN_LISTENER_PORT}" protocol="pu-protocol" transport="tcp" name="admin-listener" thread-pool="http-thread-pool"></network-listener> | |
| 379 | + </network-listeners> | |
| 380 | + <transports> | |
| 381 | + <transport name="tcp"></transport> | |
| 382 | + </transports> | |
| 383 | + </network-config> | |
| 384 | + <thread-pools> | |
| 385 | + <thread-pool name="http-thread-pool"></thread-pool> | |
| 386 | + <thread-pool max-thread-pool-size="200" name="thread-pool-1"></thread-pool> | |
| 387 | + <thread-pool name="admin-thread-pool" max-thread-pool-size="50" max-queue-size="256"></thread-pool> | |
| 388 | + </thread-pools> | |
| 389 | + <group-management-service> | |
| 390 | + <failure-detection></failure-detection> | |
| 391 | + </group-management-service> | |
| 392 | + <management-rules></management-rules> | |
| 393 | + <system-property name="ASADMIN_LISTENER_PORT" value="24848"></system-property> | |
| 394 | + <system-property name="HTTP_LISTENER_PORT" value="28080"></system-property> | |
| 395 | + <system-property name="HTTP_SSL_LISTENER_PORT" value="28181"></system-property> | |
| 396 | + <system-property name="JMS_PROVIDER_PORT" value="27676"></system-property> | |
| 397 | + <system-property name="IIOP_LISTENER_PORT" value="23700"></system-property> | |
| 398 | + <system-property name="IIOP_SSL_LISTENER_PORT" value="23820"></system-property> | |
| 399 | + <system-property name="IIOP_SSL_MUTUALAUTH_PORT" value="23920"></system-property> | |
| 400 | + <system-property name="JMX_SYSTEM_CONNECTOR_PORT" value="28686"></system-property> | |
| 401 | + <system-property name="OSGI_SHELL_TELNET_PORT" value="26666"></system-property> | |
| 402 | + <system-property name="JAVA_DEBUGGER_PORT" value="29009"></system-property> | |
| 403 | + <monitoring-service> | |
| 404 | + <module-monitoring-levels></module-monitoring-levels> | |
| 405 | + </monitoring-service> | |
| 406 | + <connector-service></connector-service> | |
| 407 | + </config> | |
| 408 | + </configs> | |
| 409 | + <property name="administrative.domain.name" value="domain1"></property> | |
| 410 | + <secure-admin special-admin-indicator="e4a50521-0eca-4932-bca9-805fc1d8412e"> | |
| 411 | + <secure-admin-principal dn="CN=localhost,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US"></secure-admin-principal> | |
| 412 | + <secure-admin-principal dn="CN=localhost-instance,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US"></secure-admin-principal> | |
| 413 | + </secure-admin> | |
| 414 | + <load-balancers></load-balancers> | |
| 415 | + <lb-configs></lb-configs> | |
| 416 | + <clusters></clusters> | |
| 417 | +</domain> | |
| 0 | 418 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +demoiselle;{SSHA256}yuPqrU5lEMJR0I4qNaegEK9hd5afM0Yo3rnLgYY7Sw0MlUFhbj9EmQ==;users | ... | ... |
| ... | ... | @@ -0,0 +1,61 @@ |
| 1 | +/* | |
| 2 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
| 3 | + * | |
| 4 | + * Copyright (c) 2004-2010 Oracle and/or its affiliates. All rights reserved. | |
| 5 | + * | |
| 6 | + * The contents of this file are subject to the terms of either the GNU | |
| 7 | + * General Public License Version 2 only ("GPL") or the Common Development | |
| 8 | + * and Distribution License("CDDL") (collectively, the "License"). You | |
| 9 | + * may not use this file except in compliance with the License. You can | |
| 10 | + * obtain a copy of the License at | |
| 11 | + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html | |
| 12 | + * or packager/legal/LICENSE.txt. See the License for the specific | |
| 13 | + * language governing permissions and limitations under the License. | |
| 14 | + * | |
| 15 | + * When distributing the software, include this License Header Notice in each | |
| 16 | + * file and include the License file at packager/legal/LICENSE.txt. | |
| 17 | + * | |
| 18 | + * GPL Classpath Exception: | |
| 19 | + * Oracle designates this particular file as subject to the "Classpath" | |
| 20 | + * exception as provided by Oracle in the GPL Version 2 section of the License | |
| 21 | + * file that accompanied this code. | |
| 22 | + * | |
| 23 | + * Modifications: | |
| 24 | + * If applicable, add the following below the License Header, with the fields | |
| 25 | + * enclosed by brackets [] replaced by your own identifying information: | |
| 26 | + * "Portions Copyright [year] [name of copyright owner]" | |
| 27 | + * | |
| 28 | + * Contributor(s): | |
| 29 | + * If you wish your version of this file to be governed by only the CDDL or | |
| 30 | + * only the GPL Version 2, indicate your decision by adding "[Contributor] | |
| 31 | + * elects to include this software in this distribution under the [CDDL or GPL | |
| 32 | + * Version 2] license." If you don't indicate a single choice of license, a | |
| 33 | + * recipient has the option to distribute your version of this file under | |
| 34 | + * either the CDDL, the GPL Version 2 or to extend the choice of license to | |
| 35 | + * its licensees as provided above. However, if you add GPL Version 2 code | |
| 36 | + * and therefore, elected the GPL Version 2 license, then the option applies | |
| 37 | + * only if the new code is made subject to such option by the copyright | |
| 38 | + * holder. | |
| 39 | + */ | |
| 40 | + | |
| 41 | +fileRealm { | |
| 42 | + com.sun.enterprise.security.auth.login.FileLoginModule required; | |
| 43 | +}; | |
| 44 | + | |
| 45 | +ldapRealm { | |
| 46 | + com.sun.enterprise.security.auth.login.LDAPLoginModule required; | |
| 47 | +}; | |
| 48 | + | |
| 49 | +solarisRealm { | |
| 50 | + com.sun.enterprise.security.auth.login.SolarisLoginModule required; | |
| 51 | +}; | |
| 52 | + | |
| 53 | +jdbcRealm { | |
| 54 | + com.sun.enterprise.security.auth.login.JDBCLoginModule required; | |
| 55 | +}; | |
| 56 | +jdbcDigestRealm { | |
| 57 | + com.sun.enterprise.security.auth.login.JDBCDigestLoginModule required; | |
| 58 | +}; | |
| 59 | +pamRealm { | |
| 60 | + com.sun.enterprise.security.auth.login.PamLoginModule required; | |
| 61 | +}; | ... | ... |
impl/extension/rest/src/test/resources/security/authentication/basic/web.xml
0 → 100644
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | +<!-- | |
| 2 | + Demoiselle Framework | |
| 3 | + Copyright (C) 2010 SERPRO | |
| 4 | + ============================================================================ | |
| 5 | + This file is part of Demoiselle Framework. | |
| 6 | + | |
| 7 | + Demoiselle Framework is free software; you can redistribute it and/or | |
| 8 | + modify it under the terms of the GNU Lesser General Public License version 3 | |
| 9 | + as published by the Free Software Foundation. | |
| 10 | + | |
| 11 | + This program is distributed in the hope that it will be useful, | |
| 12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | + GNU General Public License for more details. | |
| 15 | + | |
| 16 | + You should have received a copy of the GNU Lesser General Public License version 3 | |
| 17 | + along with this program; if not, see <http://www.gnu.org/licenses /> | |
| 18 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
| 19 | + Fifth Floor, Boston, MA 02110-1301, USA. | |
| 20 | + ============================================================================ | |
| 21 | + Este arquivo é parte do Framework Demoiselle. | |
| 22 | + | |
| 23 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
| 24 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
| 25 | + do Software Livre (FSF). | |
| 26 | + | |
| 27 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
| 28 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
| 29 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
| 30 | + para maiores detalhes. | |
| 31 | + | |
| 32 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
| 33 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses /> | |
| 34 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | |
| 35 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
| 36 | +--> | |
| 37 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | |
| 38 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> | |
| 39 | + | |
| 40 | + <listener> | |
| 41 | + <listener-class>br.gov.frameworkdemoiselle.util.ServletListener</listener-class> | |
| 42 | + </listener> | |
| 43 | + | |
| 44 | + <filter> | |
| 45 | + <filter-name>Demoiselle Servlet Filter</filter-name> | |
| 46 | + <filter-class>br.gov.frameworkdemoiselle.util.ServletFilter</filter-class> | |
| 47 | + </filter> | |
| 48 | + <filter-mapping> | |
| 49 | + <filter-name>Demoiselle Servlet Filter</filter-name> | |
| 50 | + <url-pattern>/*</url-pattern> | |
| 51 | + </filter-mapping> | |
| 52 | + | |
| 53 | + <filter> | |
| 54 | + <filter-name>Demoiselle BasicAuth Filter</filter-name> | |
| 55 | + <filter-class>br.gov.frameworkdemoiselle.security.BasicAuthFilter</filter-class> | |
| 56 | + </filter> | |
| 57 | + <filter-mapping> | |
| 58 | + <filter-name>Demoiselle BasicAuth Filter</filter-name> | |
| 59 | + <url-pattern>/*</url-pattern> | |
| 60 | + </filter-mapping> | |
| 61 | + | |
| 62 | + <servlet> | |
| 63 | + <servlet-name>Helper Servlet</servlet-name> | |
| 64 | + <servlet-class>security.authentication.basic.HelperServlet</servlet-class> | |
| 65 | + </servlet> | |
| 66 | + <servlet-mapping> | |
| 67 | + <servlet-name>Helper Servlet</servlet-name> | |
| 68 | + <url-pattern>/helper</url-pattern> | |
| 69 | + </servlet-mapping> | |
| 70 | +</web-app> | |
| 0 | 71 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | +<!-- | |
| 2 | + Demoiselle Framework | |
| 3 | + Copyright (C) 2010 SERPRO | |
| 4 | + ============================================================================ | |
| 5 | + This file is part of Demoiselle Framework. | |
| 6 | + | |
| 7 | + Demoiselle Framework is free software; you can redistribute it and/or | |
| 8 | + modify it under the terms of the GNU Lesser General Public License version 3 | |
| 9 | + as published by the Free Software Foundation. | |
| 10 | + | |
| 11 | + This program is distributed in the hope that it will be useful, | |
| 12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | + GNU General Public License for more details. | |
| 15 | + | |
| 16 | + You should have received a copy of the GNU Lesser General Public License version 3 | |
| 17 | + along with this program; if not, see <http://www.gnu.org/licenses /> | |
| 18 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
| 19 | + Fifth Floor, Boston, MA 02110-1301, USA. | |
| 20 | + ============================================================================ | |
| 21 | + Este arquivo é parte do Framework Demoiselle. | |
| 22 | + | |
| 23 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
| 24 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
| 25 | + do Software Livre (FSF). | |
| 26 | + | |
| 27 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
| 28 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
| 29 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
| 30 | + para maiores detalhes. | |
| 31 | + | |
| 32 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
| 33 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses /> | |
| 34 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | |
| 35 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
| 36 | +--> | |
| 37 | +<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 38 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> | |
| 39 | + | |
| 40 | + <interceptors> | |
| 41 | + <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class> | |
| 42 | + <class>br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor</class> | |
| 43 | + <class>br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor</class> | |
| 44 | + <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class> | |
| 45 | + </interceptors> | |
| 46 | + | |
| 47 | +</beans> | ... | ... |
| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | +<!-- | |
| 2 | + Demoiselle Framework | |
| 3 | + Copyright (C) 2010 SERPRO | |
| 4 | + ============================================================================ | |
| 5 | + This file is part of Demoiselle Framework. | |
| 6 | + | |
| 7 | + Demoiselle Framework is free software; you can redistribute it and/or | |
| 8 | + modify it under the terms of the GNU Lesser General Public License version 3 | |
| 9 | + as published by the Free Software Foundation. | |
| 10 | + | |
| 11 | + This program is distributed in the hope that it will be useful, | |
| 12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | + GNU General Public License for more details. | |
| 15 | + | |
| 16 | + You should have received a copy of the GNU Lesser General Public License version 3 | |
| 17 | + along with this program; if not, see <http://www.gnu.org/licenses /> | |
| 18 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
| 19 | + Fifth Floor, Boston, MA 02110-1301, USA. | |
| 20 | + ============================================================================ | |
| 21 | + Este arquivo é parte do Framework Demoiselle. | |
| 22 | + | |
| 23 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
| 24 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
| 25 | + do Software Livre (FSF). | |
| 26 | + | |
| 27 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
| 28 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
| 29 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
| 30 | + para maiores detalhes. | |
| 31 | + | |
| 32 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
| 33 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses /> | |
| 34 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | |
| 35 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
| 36 | +--> | |
| 37 | +<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 38 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> | |
| 39 | + | |
| 40 | + <interceptors> | |
| 41 | + <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class> | |
| 42 | + <class>br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor</class> | |
| 43 | + <class>br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor</class> | |
| 44 | + <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class> | |
| 45 | + </interceptors> | |
| 46 | + | |
| 47 | +</beans> | ... | ... |
impl/extension/servlet/src/test/java/security/authentication/basic/BasicAuthenticationFilterTest.java
| ... | ... | @@ -1,84 +0,0 @@ |
| 1 | -package security.authentication.basic; | |
| 2 | - | |
| 3 | -import static org.apache.http.HttpStatus.SC_UNAUTHORIZED; | |
| 4 | -import static org.apache.http.HttpStatus.SC_FORBIDDEN; | |
| 5 | -import static org.apache.http.HttpStatus.SC_OK; | |
| 6 | -import static org.junit.Assert.assertEquals; | |
| 7 | - | |
| 8 | -import java.io.IOException; | |
| 9 | -import java.net.URL; | |
| 10 | - | |
| 11 | -import org.apache.commons.codec.binary.Base64; | |
| 12 | -import org.apache.http.HttpEntity; | |
| 13 | -import org.apache.http.HttpResponse; | |
| 14 | -import org.apache.http.client.ClientProtocolException; | |
| 15 | -import org.apache.http.client.methods.HttpGet; | |
| 16 | -import org.apache.http.client.methods.HttpPost; | |
| 17 | -import org.apache.http.impl.client.CloseableHttpClient; | |
| 18 | -import org.apache.http.impl.client.HttpClientBuilder; | |
| 19 | -import org.jboss.arquillian.container.test.api.Deployment; | |
| 20 | -import org.jboss.arquillian.junit.Arquillian; | |
| 21 | -import org.jboss.arquillian.test.api.ArquillianResource; | |
| 22 | -import org.jboss.shrinkwrap.api.spec.WebArchive; | |
| 23 | -import org.junit.Test; | |
| 24 | -import org.junit.runner.RunWith; | |
| 25 | - | |
| 26 | -import test.Tests; | |
| 27 | - | |
| 28 | -@RunWith(Arquillian.class) | |
| 29 | -public class BasicAuthenticationFilterTest { | |
| 30 | - | |
| 31 | - private static final String PATH = "src/test/resources/security/authentication/basic"; | |
| 32 | - | |
| 33 | - @ArquillianResource | |
| 34 | - private URL deploymentUrl; | |
| 35 | - | |
| 36 | - @Deployment(testable = false) | |
| 37 | - public static WebArchive createDeployment() { | |
| 38 | - return Tests.createDeployment().addClasses(BasicAuthenticationFilterTest.class) | |
| 39 | - .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | |
| 40 | - } | |
| 41 | - | |
| 42 | - @Test | |
| 43 | - public void loginSucessfull() throws ClientProtocolException, IOException { | |
| 44 | - CloseableHttpClient client = HttpClientBuilder.create().build(); | |
| 45 | - HttpGet get; | |
| 46 | - HttpResponse response; | |
| 47 | - int status; | |
| 48 | - | |
| 49 | - String username = "demoiselle"; | |
| 50 | - String password = "changeit"; | |
| 51 | - get = new HttpGet(deploymentUrl + "/helper"); | |
| 52 | - byte[] encoded = Base64.encodeBase64((username + ":" + password).getBytes()); | |
| 53 | - get.setHeader("Authorization", "Basic " + new String(encoded)); | |
| 54 | - response = client.execute(get); | |
| 55 | - status = response.getStatusLine().getStatusCode(); | |
| 56 | - assertEquals(SC_OK, status); | |
| 57 | - | |
| 58 | - get = new HttpGet(deploymentUrl + "/helper"); | |
| 59 | - response = client.execute(get); | |
| 60 | - status = response.getStatusLine().getStatusCode(); | |
| 61 | - assertEquals(SC_FORBIDDEN, status); | |
| 62 | - } | |
| 63 | - | |
| 64 | - @Test | |
| 65 | - public void loginFailed() throws ClientProtocolException, IOException { | |
| 66 | - String username = "invalid"; | |
| 67 | - String password = "invalid"; | |
| 68 | - | |
| 69 | - | |
| 70 | - HttpPost x = new HttpPost(); | |
| 71 | - x.setEntity(null); | |
| 72 | - | |
| 73 | - //HttpEntity entity | |
| 74 | - | |
| 75 | - HttpGet get = new HttpGet(deploymentUrl + "/helper"); | |
| 76 | - byte[] encoded = Base64.encodeBase64((username + ":" + password).getBytes()); | |
| 77 | - get.setHeader("Authorization", "Basic " + new String(encoded)); | |
| 78 | - | |
| 79 | - HttpResponse response = HttpClientBuilder.create().build().execute(get); | |
| 80 | - | |
| 81 | - int status = response.getStatusLine().getStatusCode(); | |
| 82 | - assertEquals(SC_UNAUTHORIZED, status); | |
| 83 | - } | |
| 84 | -} |
impl/extension/servlet/src/test/java/security/authentication/basic/HelperServlet.java
| ... | ... | @@ -1,30 +0,0 @@ |
| 1 | -package security.authentication.basic; | |
| 2 | - | |
| 3 | -import static org.apache.http.HttpStatus.SC_FORBIDDEN; | |
| 4 | -import static org.apache.http.HttpStatus.SC_OK; | |
| 5 | - | |
| 6 | -import java.io.IOException; | |
| 7 | - | |
| 8 | -import javax.servlet.ServletException; | |
| 9 | -import javax.servlet.http.HttpServlet; | |
| 10 | -import javax.servlet.http.HttpServletRequest; | |
| 11 | -import javax.servlet.http.HttpServletResponse; | |
| 12 | - | |
| 13 | -import br.gov.frameworkdemoiselle.security.SecurityContext; | |
| 14 | -import br.gov.frameworkdemoiselle.util.Beans; | |
| 15 | - | |
| 16 | -public class HelperServlet extends HttpServlet { | |
| 17 | - | |
| 18 | - private static final long serialVersionUID = 1L; | |
| 19 | - | |
| 20 | - @Override | |
| 21 | - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
| 22 | - boolean loggedIn = Beans.getReference(SecurityContext.class).isLoggedIn(); | |
| 23 | - | |
| 24 | - if (loggedIn) { | |
| 25 | - response.setStatus(SC_OK); | |
| 26 | - } else { | |
| 27 | - response.setStatus(SC_FORBIDDEN); | |
| 28 | - } | |
| 29 | - } | |
| 30 | -} |
impl/extension/servlet/src/test/resources/security/authentication/basic/web.xml
| ... | ... | @@ -1,70 +0,0 @@ |
| 1 | -<!-- | |
| 2 | - Demoiselle Framework | |
| 3 | - Copyright (C) 2010 SERPRO | |
| 4 | - ============================================================================ | |
| 5 | - This file is part of Demoiselle Framework. | |
| 6 | - | |
| 7 | - Demoiselle Framework is free software; you can redistribute it and/or | |
| 8 | - modify it under the terms of the GNU Lesser General Public License version 3 | |
| 9 | - as published by the Free Software Foundation. | |
| 10 | - | |
| 11 | - This program is distributed in the hope that it will be useful, | |
| 12 | - but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | - GNU General Public License for more details. | |
| 15 | - | |
| 16 | - You should have received a copy of the GNU Lesser General Public License version 3 | |
| 17 | - along with this program; if not, see <http://www.gnu.org/licenses /> | |
| 18 | - or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
| 19 | - Fifth Floor, Boston, MA 02110-1301, USA. | |
| 20 | - ============================================================================ | |
| 21 | - Este arquivo é parte do Framework Demoiselle. | |
| 22 | - | |
| 23 | - O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
| 24 | - modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
| 25 | - do Software Livre (FSF). | |
| 26 | - | |
| 27 | - Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
| 28 | - GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
| 29 | - APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
| 30 | - para maiores detalhes. | |
| 31 | - | |
| 32 | - Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
| 33 | - "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses /> | |
| 34 | - ou escreva para a Fundação do Software Livre (FSF) Inc., | |
| 35 | - 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
| 36 | ---> | |
| 37 | -<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | |
| 38 | - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> | |
| 39 | - | |
| 40 | - <listener> | |
| 41 | - <listener-class>br.gov.frameworkdemoiselle.util.ServletListener</listener-class> | |
| 42 | - </listener> | |
| 43 | - | |
| 44 | - <filter> | |
| 45 | - <filter-name>Demoiselle Servlet Filter</filter-name> | |
| 46 | - <filter-class>br.gov.frameworkdemoiselle.util.ServletFilter</filter-class> | |
| 47 | - </filter> | |
| 48 | - <filter-mapping> | |
| 49 | - <filter-name>Demoiselle Servlet Filter</filter-name> | |
| 50 | - <url-pattern>/*</url-pattern> | |
| 51 | - </filter-mapping> | |
| 52 | - | |
| 53 | - <filter> | |
| 54 | - <filter-name>Demoiselle BasicAuth Filter</filter-name> | |
| 55 | - <filter-class>br.gov.frameworkdemoiselle.util.BasicAuthFilter</filter-class> | |
| 56 | - </filter> | |
| 57 | - <filter-mapping> | |
| 58 | - <filter-name>Demoiselle BasicAuth Filter</filter-name> | |
| 59 | - <url-pattern>/*</url-pattern> | |
| 60 | - </filter-mapping> | |
| 61 | - | |
| 62 | - <servlet> | |
| 63 | - <servlet-name>Helper Servlet</servlet-name> | |
| 64 | - <servlet-class>security.authentication.basic.HelperServlet</servlet-class> | |
| 65 | - </servlet> | |
| 66 | - <servlet-mapping> | |
| 67 | - <servlet-name>Helper Servlet</servlet-name> | |
| 68 | - <url-pattern>/helper</url-pattern> | |
| 69 | - </servlet-mapping> | |
| 70 | -</web-app> | |
| 71 | 0 | \ No newline at end of file |