sunnuntai 22. tammikuuta 2012

Jetty 8 and using ssl with jetty:run

<plugin>
  <groupid>org.mortbay.jetty</groupid>
  <artifactid>jetty-maven-plugin</artifactid>
  <version>8.0.4.v20111024</version>
  <configuration>
    <scanintervalseconds>5</scanintervalseconds>
    <webappconfig>
      <contextpath>/</contextpath>
    </webappconfig>
    <connectors>
      <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <port>8080</port>
      </connector>
      <connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
        <port>8443</port>
        <keystore>/etc/keystore/keystore</keystore>
        <keypassword>password</keypassword>
        <password>password</password>
      </connector>
   </connectors>
</configuration>
</plugin>

Add this to your pom.xml inside <build> and <plugins> tags.
Of course you also need to have keystore in place. See Jetty/Howto/Configure_SSL.

lauantai 21. tammikuuta 2012

Spring-security start project with mongodb

I started up making a custom signup && login to Uutispuro and it was working nicely. A Couple of years ago I looked at spring-security for this, but it seemed like an overblow. When Spring 3.1 was out, I happened to look at spring-security again. And I tried it. No turning back now :)

I made a small start project to github: springsecuritylogin.

There is no ssl-support of course, you need to add to your application server. Handling sessions with memcached is something I'd still like to add. Maybe tomorrow ...

The project adds users with a signup page. Default role is ROLE_USER. You can modify a user to be an "ROLE_ADMIN" user by hand, and the index pages verifies the current role used.