Glassfish and Spring Security have different default ports for https traffic 8181 vs 8443. To get that working right in a development environment I did the following:
pom.xml:
<properties>
<http.port>8080</http.port>
<http.port>8181</http.port>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</reources>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources/WEB-INF/context</directory>
<targetPath>WEB-INF/context</targetPath>
<includes>
<include>applicationContext.xml</include>
<include>applicationContext-security.xml</include>
<include>datasourceContext.xml</include>
</includes>
</resource>
...
<profiles>
<profile>
<id>production</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<http.port>80</http.port>
<https.port>443</https.port>
</properties>
</profile>
applicationContext-security.xml:
<http>
<intercept-url pattern="/" access="permitAll" requires-channel="https"/>
<intercept-url pattern="/**" access="hasRole('USER')" requires-channel="https" />
<port-mappings>
<port-mapping http="${http.port}" https="${https.port}"/>
</port-mappings>
</http>
Part of the answer came from here about moving context files to resources though I am using Netbeans, so I didn't have to worry about m2e problems he had.
title
fire chief's random developer tidbits
Showing posts with label security. Show all posts
Showing posts with label security. Show all posts
Thursday, July 25, 2013
Wednesday, February 9, 2011
Most awesome error message ever
Trying to list the contents of a keystore I got the most awesome error message ever:
$ keytool -list -keystore keystore.jks
$ keytool -list -keystore keystore.jks
keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic
uh, what?
$ which keytool
/usr/bin/keytool
Also notice it has "gnu" in the class name. The path /usr/bin wins over the later path /opt/jdk1.6.0_21/bin which is the keytool I actually wanted since I'm using Sun and not GNU.
Subscribe to:
Posts (Atom)