implicit.ly

Scala software, hot off the presses

Lift Shiro 0.0.5

This update moves the integration away from snapshot and milestone dependencies and onto the final releases of both Shiro 1.2.0 and Lift 2.4.

In addition to this, the published JARs no longer sit on scala-tools.org, but rather they live on oss.sonatype.org. Please update your SBT resolver configuration to:

libraryDependencies += "eu.getintheloop" %% "lift-shiro" % "0.0.5"

resolvers ++= Seq( "apache.repo" at "https://repository.apache.org/content/repositories/releases/" "sonatype.repo" at "https://oss.sonatype.org/content/repositories/public/" )

</code></pre>

Lift Shiro

This is an integration between Apache Shiro and the Lift Web framework. Specifically this integration does not use Shiro's built in web.xml resource filters to control access to URLs... it instead uses Lift's sitemap Locs. In addition it also has a range of snippets for conditionally displaying content based on rules and permissions.

Please see this README for more information on project setup and usage.

Filed under  //   Lift Shiro   Scala 2.8.1   Scala 2.9.0   Scala 2.9.0-1   Scala 2.9.1   eu.getintheloop  

sbt-cloudbees-plugin 0.4.0

Version 4.0 has been a major rewrite to make use of the more idiomatic task functionaltiy within SBT 0.10+

Major changes:

  • Plugin now works with SBT 0.11.2 only
  • Use of the $HOME/.bees directory for configuration is now gone. In order to become more inline with SBT conventions configuration now takes place in the ~/.sbt/user.sbt
  • The deployment task name has changed from bees-deploy to cloudbees-deploy
  • The remote application list task has changed from bees-app-list to cloudbees-applications
  • All settings and tasks are prefixed cloudbees, so they should be easy to find in the console
  • Prompting for settings that are undefined is gone. All settings are checked before use and will deliver an error in the console if the appropriate setting is empty.

CloudBees Run@Cloud SBT Plugin

Integration for SBT that lets you deploy apps to the CloudBees RUN@Cloud PaaS

Usage

Firstly you need to add the plugin to your ~/.sbt/user.sbt or to your regular project build.sbt. You can do that with the following:

resolvers += "sonatype.repo" at "https://oss.sonatype.org/content/groups/public"

addSbtPlugin("eu.getintheloop" %% "sbt-cloudbees-plugin" % "0.4.0-SNAPSHOT") </code></pre>

Don't forget to export the settings so they are included by SBT:

seq(cloudBeesSettings :_*)

With those in place, the next thing you'll need to do is head over to grandcentral.cloudbees.com and pickup your API key and secret. These should look like:

Grand Central Keys

Take these values and apply them in your user.sbt (or regular build file):

seq(cloudBeesSettings :_*)

CloudBees.apiKey := Some("FXXXXXXXXXXX")

CloudBees.apiSecret := Some("AAAAAAAAAAAAAAAAAAAA=") </code></pre>

These of course are global settings per-machine, so the only application specific settings you need to define are the application and user in your project file. Alternativly, you could also define the username globally too:

CloudBees.username := Some("youruser")

CloudBees.applicationId := Some("yourapp") </code></pre>

Now your all configured and good to go, there are two commands you can run with this plugin:

  • Get a list of your configured applications: cloudbees-applications
  • Deploy your application cloudbees-deploy

Filed under  //   Scala 2.9.1   eu.getintheloop   sbt-cloudbees-plugin  

Lift Shiro 0.0.4

YOU MUST USE LIFT 2.4-M4 FOR THIS PLUGIN TO WORK

This update brings a set of a new possible tags and location parameters that can be applied to the SiteMap for additional functionality. New operations include:

  • remember login subjects
  • force forgetting the subject
  • matchers for checking that a subject is one of any of n roles
  • snippet for accessing the subject principal

In addition the build was updated to use SBT 0.11.

Lift Shiro

This is an integration between Apache Shiro and the Lift Web framework. Specifically this integration does not use Shiro's built in web.xml resource filters to control access to URLs... it instead uses Lift's sitemap Locs. In addition it also has a range of snippets for conditionally displaying content based on rules and permissions.

Please see this README for more information on project setup and usage.

Filed under  //   Lift Shiro   Scala 2.8.1   Scala 2.9.0   Scala 2.9.0-1   Scala 2.9.1   eu.getintheloop  

Lift Shiro 0.0.3

YOU MUST USE LIFT 2.4-M4 FOR THIS PLUGIN TO WORK

First, add the SBT dependency:

libraryDependencies += "eu.getintheloop" %% "lift-shiro" % "0.0.3"

Next, you need to add this to the web.xml within your project in order to initialise the Shiro context when your application receives a request:

<listener>
    <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
  </listener>
  <filter>
    <filter-name>ShiroFilter</filter-name>
    <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>ShiroFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

Next, you need to add some configuration to your Boot.scala like so:

class Boot {
  def boot {
    import shiro.Shiro
    import shiro.sitemap.Locs._
    Shiro.init()
    ...
  }
}

By default this uses the Shiro IniSecurityManagerFactory meaning you need to supply a shiro.ini at the root of your classpath that uses the Shiro ini configuration style. If however you want to use another security manager, you simply supply it into the init() method like so:

Shiro.init(new IniSecurityManagerFactory("classpath:shiro.ini"))

In order to actually use the integration within your sitemap to restrict access to resources, apply it to your SiteMap like so:

LiftRules.setSiteMap(SiteMap(List(
    Menu("Home") / "index" >> RequireAuthentication,
    Menu("Role Test") / "restricted" >> RequireAuthentication >> HasRole("admin"),
    Menu("Login") / "login" >> RequireNoAuthentication
    ) ::: Shiro.menus: _*
  ))

There are several LocParam that you can use to augment your Menu structure. Specifically you can use:

  • RequireAuthentication - Ensures that users are authenticated, irrespective of roles or permissions
  • HasRole("rolename") - Ensures that user has a specific role.
  • HasPermission("somePermission") - Ensures that user has a specific permission.
  • LacksPermission("permissionName") - Ensures that user lacks a specific permission.

In addition to using the integration in the SiteMap, you can also use it within your markup using the following snippet technique:

<lift:has_role name="someRole">
    Some content that is only available to users who have the "someRole" role assigned to them
  </lift:has_role>

The snippets this integration wires in are the follow (all are methods on subject/subjects):

  • has_role
  • lacks_role
  • has_permission
  • lacks_permission
  • hasanyroles

All use the name attribute, with the exception of has_any_roles which takes the roles attribute which contains a comma-delimited list of assigned roles.

Lift Shiro

This is an integration between Apache Shiro and the Lift Web framework. Specifically this integration does not use Shiro's built in web.xml resource filters to control access to URLs... it instead uses Lift's sitemap Locs. In addition it also has a range of snippets for conditionally displaying content based on rules and permissions.

Filed under  //   Lift Shiro   Scala 2.8.1   Scala 2.9.0   Scala 2.9.0-1   Scala 2.9.1   eu.getintheloop  

sbt-cloudbees-plugin 0.3.1

Changes to the build so that you can use the plugin with various different versions of SBT (0.10.0, 0.10.1).

All features remain the same.

CloudBees Run@Cloud SBT Plugin

Integration for SBT that lets you deploy apps to the CloudBees RUN@Cloud PaaS

Usage

Firstly, you need to grab the key and secret from grandcentral.cloudbees.com, which should look like:

Grand Central Keys

Once you have these two values, you can do one of two things:

  • Enter them when the plugin prompts you; this will be on everytime you run a deployment to the cloud
  • Create a properties file called bees.config in $HOME/.bees/ so that you only need to define them once per computer. This properties file needs to be a key-value pair style like this:
bees.api.key=XXXXXXXXXX
bees.api.secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX=

Whichever route you choose to specify that information, you then only need to define the plugin information in any given project. Specifically, in project/plugins/build.sbt define the following:

resolvers += "sonatype.repo" at "https://oss.sonatype.org/content/groups/public"

libraryDependencies <+= sbtVersion(v => "eu.getintheloop" %% "sbt-cloudbees-plugin" % ("0.3.1_"+v)) </code></pre>

Add the plugin to your built.sbt project file like so:

seq(bees.RunCloudPlugin.deploymentSettings :_*)

Again, if you would prefer to enter these values when you deploy your application then you can of course just enter the appropriate values when prompted. Now your all configured and good to go, there are two commands you can run with this plugin:

  • Get a list of your configured applications: bees-app-list
  • Deploy your application bees-deploy

Filed under  //   Scala 2.8.1   eu.getintheloop   sbt-cloudbees-plugin  

sbt-cloudbees-plugin 0.3.0

Reworking for SBT 0.10.1. Currently only support SBT 0.10.1 until I have time to figure the multi-version build process! Mandatory hat tip to Lucien Pereira (https://github.com/lpereir4) for contributing the deploy code after my initial reworking of the plugin.

To clarify, currently only supporting SBT 0.10.1

Enjoy!

CloudBees Run@Cloud SBT Plugin

Integration for SBT that lets you deploy apps to the CloudBees RUN@Cloud PaaS

Usage

Firstly, you need to grab the key and secret from grandcentral.cloudbees.com, which should look like:

Grand Central Keys

Once you have these two values, you can do one of two things:

  • Enter them when the plugin prompts you; this will be on everytime you run a deployment to the cloud
  • Create a properties file called bees.config in $HOME/.bees/ so that you only need to define them once per computer. This properties file needs to be a key-value pair style like this:
bees.api.key=XXXXXXXXXX
bees.api.secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX=

Whichever route you choose to specify that information, you then only need to define the plugin information in any given project. Specifically, in project/plugins/build.sbt define the following:

resolvers += "sonatype.repo" at "https://oss.sonatype.org/content/groups/public"

libraryDependencies += "eu.getintheloop" %% "sbt-cloudbees-plugin" % "0.3.0" </code></pre>

Add the plugin to your built.sbt project file like so:

seq(bees.RunCloudPlugin.deploymentSettings :_*)

Again, if you would prefer to enter these values when you deploy your application then you can of course just enter the appropriate values when prompted. Now your all configured and good to go, there are two commands you can run with this plugin:

  • Get a list of your configured applications: bees-app-list
  • Deploy your application bees-deploy

Filed under  //   Scala 2.8.1   eu.getintheloop   sbt-cloudbees-plugin  

sbt-cloudbees-plugin 0.2.7

Now supporting delta-updates of WAR files. This slashes the amount of time it takes to deploy a file to Run@Cloud to a few seconds.

Changes:

  • Added new control "beesShouldDeltaWar". If for some reason you don't want to use the delta WAR functionality then you should just set override def beesShouldDeltaWar = false within your project file.

CloudBees Run@Cloud SBT Plugin

Integration for SBT that lets you deploy apps to the CloudBees RUN@Cloud PaaS

Usage

Firstly, you need to grab the key and secret from grandcentral.cloudbees.com, which should look like:

Grand Central Keys

Once you have these two values, you can do one of two things:

  • Enter them when the plugin prompts you; this will be on everytime you run a deployment to the cloud
  • Create a properties file called bees.config in $HOME/.bees/ so that you only need to define them once per computer. This properties file needs to be a key-value pair style like this:
bees.api.key=XXXXXXXXXX
bees.api.secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX=

Whichever route you choose to specify that information, you then only need to define the plugin information in any given project. Specifically, in the Plugins.scala file define the following:

import sbt._
  class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
    lazy val cloudbees = "eu.getintheloop" % "sbt-cloudbees-plugin" % "0.2.6"
    lazy val sonatypeRepo = "sonatype.repo" at "https://oss.sonatype.org/content/groups/public"
  }

Add the plugin to your SBT project like so:

import sbt._
  class YourProject(info: ProjectInfo) extends DefaultWebProject(info) with bees.RunCloudPlugin {
    ....
    override def beesApplicationId = Some("whatever")
    override def beesUsername = Some("youruser")
  }

Again, if you would prefer to enter these values when you deploy your application then you can of course just enter the appropriate values when prompted. Now your all configured and good to go, there are two commands you can run with this plugin:

  • Get a list of your configured applications: bees-applist
  • Deploy your application bees-deploy

Filed under  //   Scala 2.7.7   eu.getintheloop   sbt-cloudbees-plugin  

sbt-cloudbees-plugin 0.2.6

After stax.net was acquired by CloudBees it made sense to move to the new endpoints etc to ensure on-going usefulness of the plugin in case the stax.net endpoints are ever decommissioned. This version is a complete rewrite from the previous version.

Changes:

  • If any configuration parameter is not defined, the plugin auto-prompts you for it
  • Now deploy your application with "bees-deploy" in place of "stax-deploy"
  • Rename your staxApplicationId to beesApplicationId
  • Rename your staxUsername to beesUsername

CloudBees Run@Cloud SBT Plugin

Integration for SBT that lets you deploy apps to the CloudBees RUN@Cloud PaaS

Usage

Firstly, you need to grab the key and secret from grandcentral.cloudbees.com, which should look like:

Grand Central Keys

Once you have these two values, you can do one of two things:

  • Enter them when the plugin prompts you; this will be on everytime you run a deployment to the cloud
  • Create a properties file called bees.config in $HOME/.bees/ so that you only need to define them once per computer. This properties file needs to be a key-value pair style like this:
bees.api.key=XXXXXXXXXX
bees.api.secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX=

Whichever route you choose to specify that information, you then only need to define the plugin information in any given project. Specifically, in the Plugins.scala file define the following:

import sbt._
  class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
    lazy val cloudbees = "eu.getintheloop" % "sbt-cloudbees-plugin" % "0.2.6"
    lazy val sonatypeRepo = "sonatype.repo" at "https://oss.sonatype.org/content/groups/public"
  }

Add the plugin to your SBT project like so:

import sbt._
  class YourProject(info: ProjectInfo) extends DefaultWebProject(info) with bees.RunCloudPlugin {
    ....
    override def beesApplicationId = Some("whatever")
    override def beesUsername = Some("youruser")
  }

Again, if you would prefer to enter these values when you deploy your application then you can of course just enter the appropriate values when prompted. Now your all configured and good to go, there are two commands you can run with this plugin:

  • Get a list of your configured applications: bees-applist
  • Deploy your application bees-deploy

Filed under  //   Scala 2.7.7   eu.getintheloop   sbt-cloudbees-plugin  

sbt-stax-plugin 0.1.2

Fixed:

  • Scenario where multiple users wanted to deploy the same application for which they were not the direct owner.

Integration for SBT that lets you deploy apps to the awesome stax.net cloud

Usage

Define the plugin information in your Plugins.scala

class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
    val stax = "eu.getintheloop" % "sbt-stax-plugin" % "1.0"
    // repos
    val staxReleases = "stax-release-repo" 
      at "http://mvn.stax.net/content/repositories/public"
  }

Add the stax plugin to your SBT project

class LiftTravelProject(info: ProjectInfo) 
      extends DefaultWebProject(info) 
      with stax.StaxPlugin {
        ....
        // stax
        override def staxApplicationId = "whatever"
        override def staxUsername = "youruser"
        // leave out and you'll be prompted at deploy time
        // override def staxPassword = "password"
      }

Now your all configured and good to go, just run the deploy action in SBT console:

stax-deploy

Filed under  //   Scala 2.7.7   eu.getintheloop   sbt-stax-plugin  

sbt-stax-plugin 0.1.1

Initial release:

  • Supporting the "deploy" method for getting your file onto stax.net cloud

Known issues:

  • Currently, we only support WAR files, not EAR.

Integration for SBT that lets you deploy apps to the awesome stax.net cloud

Usage

Define the plugin information in your Plugins.scala

class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
    val stax = "eu.getintheloop" % "sbt-stax-plugin" % "1.0"
    // repos
    val staxReleases = "stax-release-repo" 
      at "http://mvn.stax.net/content/repositories/public"
  }

Add the stax plugin to your SBT project

class LiftTravelProject(info: ProjectInfo) 
      extends DefaultWebProject(info) 
      with stax.StaxPlugin {
        ....
        // stax
        override def staxApplicationId = "whatever"
        override def staxUsername = "youruser"
        // leave out and you'll be prompted at deploy time
        // override def staxPassword = "password"
      }

Now your all configured and good to go, just run the deploy action in SBT console:

stax-deploy

Filed under  //   Scala 2.7.7   eu.getintheloop   sbt-stax-plugin