<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>objectuser.blog(brain)</title>
	<atom:link href="https://objectuser.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://objectuser.wordpress.com</link>
	<description>objectuser.getBlog().contains(anything)</description>
	<lastBuildDate>Mon, 23 Feb 2015 02:30:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='objectuser.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://secure.gravatar.com/blavatar/744f0f3f1a4ae75ebde6a8d4b648d24f76a258ad657cb7936f6535dd7953b3c3?s=96&#038;d=https%3A%2F%2Fs0.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>objectuser.blog(brain)</title>
		<link>https://objectuser.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://objectuser.wordpress.com/osd.xml" title="objectuser.blog(brain)" />
	<atom:link rel='hub' href='https://objectuser.wordpress.com/?pushpress=hub'/>
	<item>
		<title>Next Project: Pneumatic.IO</title>
		<link>https://objectuser.wordpress.com/2015/02/22/next-project-pneumatic-io/</link>
					<comments>https://objectuser.wordpress.com/2015/02/22/next-project-pneumatic-io/#respond</comments>
		
		<dc:creator><![CDATA[objectuser]]></dc:creator>
		<pubDate>Mon, 23 Feb 2015 02:30:15 +0000</pubDate>
				<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">http://objectuser.wordpress.com/?p=411</guid>

					<description><![CDATA[I have a new project. It&#8217;s an open source ETL and IO platform called Pneumatic.IO. I&#8217;m blogging about it at that address. The project is hosted on Github. I hope you&#8217;ll check it out, provide some feedback and maybe even get involved.]]></description>
										<content:encoded><![CDATA[<p>I have a new project. It&#8217;s an open source ETL and IO platform called <a href="http://pneumatic.io">Pneumatic.IO</a>.</p>
<p>I&#8217;m blogging about it at that address. The project is hosted on <a href="https://github.com/objectuser/pneumatic">Github</a>. I hope you&#8217;ll check it out, provide some feedback and maybe even get involved.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://objectuser.wordpress.com/2015/02/22/next-project-pneumatic-io/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:content url="https://1.gravatar.com/avatar/770607414278dd771194721b83b2ac702bd954edc98ce53797cf8324bfe57eb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">objectuser</media:title>
		</media:content>
	</item>
		<item>
		<title>Fuzed Forums Adds Google Search</title>
		<link>https://objectuser.wordpress.com/2012/01/30/fuzed-forums-adds-google-search/</link>
					<comments>https://objectuser.wordpress.com/2012/01/30/fuzed-forums-adds-google-search/#respond</comments>
		
		<dc:creator><![CDATA[objectuser]]></dc:creator>
		<pubDate>Tue, 31 Jan 2012 02:52:47 +0000</pubDate>
				<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">http://objectuser.wordpress.com/?p=395</guid>

					<description><![CDATA[Fuzed Forums continues to evolve and prepare for its official launch.  I&#8217;ve now integrated Google Search into the system.  It was a little more interesting than I expected and there are some more things to figure out, but it&#8217;s now working as expected. Fuzed Forums is, as you may know, a GWT site.  There are [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="http://www.fuzedforums.com">Fuzed Forums</a> continues to evolve and prepare for its official launch.  I&#8217;ve now integrated Google Search into the system.  It was a little more interesting than I expected and there are some more things to figure out, but it&#8217;s now working as expected.</p>
<p>Fuzed Forums is, as you may know, a GWT site.  There are some special things that must be done in order for the Googlebot to understand a site rendered with AJAX.</p>
<p>Then the search itself must be integrated into the site.  I didn&#8217;t want to compromise the integrity of the GWT interface by using a separate traditional HTML page, so there were some tricks I had to figure out to make that happen (maybe I&#8217;ll blog about that soon, but some Googling of your own would probably reveal a path).</p>
<p>In any case, it&#8217;s good to have it working.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://objectuser.wordpress.com/2012/01/30/fuzed-forums-adds-google-search/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:content url="https://1.gravatar.com/avatar/770607414278dd771194721b83b2ac702bd954edc98ce53797cf8324bfe57eb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">objectuser</media:title>
		</media:content>
	</item>
		<item>
		<title>Google Chrome User Profiles</title>
		<link>https://objectuser.wordpress.com/2012/01/08/google-chrome-user-profiles/</link>
					<comments>https://objectuser.wordpress.com/2012/01/08/google-chrome-user-profiles/#respond</comments>
		
		<dc:creator><![CDATA[objectuser]]></dc:creator>
		<pubDate>Sun, 08 Jan 2012 14:12:28 +0000</pubDate>
				<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">http://objectuser.wordpress.com/?p=393</guid>

					<description><![CDATA[I&#8217;m coming late to the party on this, but I just found out that Google Chrome now supports multiple user profiles.  This allows one Chrome installation to be personalized to each user that uses it.  The target of this feature is for the convenience of people that share a computer, allowing each to personalize Chrome [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I&#8217;m coming late to the party on this, but I just found out that Google Chrome now supports <a href="http://support.google.com/chrome/bin/answer.py?hl=en&amp;answer=2364824&amp;topic=1678460&amp;ctx=topic">multiple user profiles</a>.  This allows one Chrome installation to be personalized to each user that uses it.  The target of this feature is for the convenience of people that share a computer, allowing each to personalize Chrome with their own theme, bookmarks, apps, accounts, etc.</p>
<p>We have plenty of computers at my house, so sharing Chrome with others is not an issue for me.  However, I do have several Google accounts: personal, business, project &#8230; and Google helps by allowing me to be signed in to several at once, and allowing me to switch between them.  However, it&#8217;s not perfect.  There are still times where I need to sign out of other accounts so Google can figure out which account I want to use to access a particular service.</p>
<p>Having multiple users in Chrome allows me to target a browser window to a particular account, without confusion.  Chrome even shows a small icon at the top right of the window so you can quickly see &#8220;who you are&#8221;.</p>
<p>Good stuff so thanks to the Google Chrome team!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://objectuser.wordpress.com/2012/01/08/google-chrome-user-profiles/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:content url="https://1.gravatar.com/avatar/770607414278dd771194721b83b2ac702bd954edc98ce53797cf8324bfe57eb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">objectuser</media:title>
		</media:content>
	</item>
		<item>
		<title>Features vs Infrastructure</title>
		<link>https://objectuser.wordpress.com/2012/01/06/features-vs-infrastructure/</link>
					<comments>https://objectuser.wordpress.com/2012/01/06/features-vs-infrastructure/#respond</comments>
		
		<dc:creator><![CDATA[objectuser]]></dc:creator>
		<pubDate>Fri, 06 Jan 2012 13:31:11 +0000</pubDate>
				<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">http://objectuser.wordpress.com/?p=391</guid>

					<description><![CDATA[While developing Fuzed Forums, I quickly became aware of the cost of the software infrastructure.  By this I mean that part of a system that does not directly contribute to the features users want, but rather the functions the system needs. Fuzed Forums is developed on Google&#8217;s App Engine.  GAE offers most of the features developers are [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>While developing <a href="http://www.fuzedforums.com/">Fuzed Forums</a>, I quickly became aware of the cost of the software infrastructure.  By this I mean that part of a system that does not directly contribute to the features <em>users want</em>, but rather the functions the <em>system needs</em>.</p>
<p>Fuzed Forums is developed on Google&#8217;s App Engine.  GAE offers most of the features developers are used to, starting with a servlet environment, a datastore, security mechanisms and more.</p>
<p>For Fuzed Forums, however, some of these out-of-the-box features weren&#8217;t quite enough.  I couldn&#8217;t simply authenticate users, for example.  A user authenticated for one forum is not necessarily authenticated for any other forum.  On the other hand, they may be authenticated for more than one forum at once.  That functionality required a bit of customization of the security features offered by <a href="http://shiro.apache.org/">Apache Shiro</a>, which Fuzed Forums uses for  authentication and authorization.</p>
<p>There were other items like this, including working around the limitations of GAE&#8217;s SSL support, managing the context of a request, wiring together various third-party libraries &#8230; it&#8217;s a lot.</p>
<p>This makes we wonder if I did something wrong with my approach to Fuzed Forums.  Realistically, I almost certainly did.  However, I think it&#8217;s also true that much of the easy software has been done and most interesting things require working around the typical usage patterns of various software components (unless you have a really clever idea of course).</p>
]]></content:encoded>
					
					<wfw:commentRss>https://objectuser.wordpress.com/2012/01/06/features-vs-infrastructure/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:content url="https://1.gravatar.com/avatar/770607414278dd771194721b83b2ac702bd954edc98ce53797cf8324bfe57eb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">objectuser</media:title>
		</media:content>
	</item>
		<item>
		<title>Introducing Fuzed Forums</title>
		<link>https://objectuser.wordpress.com/2011/12/05/introducing-fuzed-forums/</link>
					<comments>https://objectuser.wordpress.com/2011/12/05/introducing-fuzed-forums/#respond</comments>
		
		<dc:creator><![CDATA[objectuser]]></dc:creator>
		<pubDate>Tue, 06 Dec 2011 01:29:24 +0000</pubDate>
				<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">http://objectuser.wordpress.com/?p=376</guid>

					<description><![CDATA[Today I&#8217;d like to announce Fuzed Forums. Fuzed Forums is my take on the next generation of forums.  It&#8217;s a place to create communities, to share and to communicate. Fuzed Forums uses GWT and Google App Engine for more of a moden web dynamic, and the forum layouts you&#8217;re probably familiar with, to create what [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Today I&#8217;d like to announce <a href="http://www.fuzedforums.com">Fuzed Forums</a>. Fuzed Forums is my take on the next generation of forums.  It&#8217;s a place to create communities, to share and to communicate. Fuzed Forums uses GWT and Google App Engine for more of a moden web dynamic, and the forum layouts you&#8217;re probably familiar with, to create what I hope to be a fast and pleasing forum experience for you and your members.</p>
<p>Fuzed Forums is now in &#8220;demo&#8221; mode.  This means it&#8217;s up and working and you can try it out.  But I want your feedback to incorporate it before it is released for your production use.  It also means that the data you create won&#8217;t survive after demo mode.  So take that as an invitation and a warning.</p>
<p>An easy way to try out Fuzed Forums is to visit the <a href="http://support.fuzedtest.appspot.com">support forum</a>.  Like the rest of this &#8220;demo&#8221;, this version of the support forum will not survive when Fuzed Forums moves out of demo, but you can get the feel of Fuzed Forums and provide feedback to make Fuzed Forums more of what you want for your community.  Also within the support forum is an area to provide feedback, proposing features or changes, whatever would like to see become part of Fuzed Forums.</p>
<p>If you want to try it out with a bit more content, visit <a href="http://one.fuzedtest.appspot.com">The One Forum</a>, which is filled with generated content.</p>
<p>If you want to find out where it&#8217;s going, more about the current limitations and more, see the &#8220;path&#8221; <a href="http://www.fuzedforums.com/path">here</a>.  You&#8217;ll notice that some things aren&#8217;t quite &#8220;done&#8221;, but I wanted to get this demo in front of people sooner rather than later.</p>
<p>Try it out and let me know what you think!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://objectuser.wordpress.com/2011/12/05/introducing-fuzed-forums/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:content url="https://1.gravatar.com/avatar/770607414278dd771194721b83b2ac702bd954edc98ce53797cf8324bfe57eb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">objectuser</media:title>
		</media:content>
	</item>
		<item>
		<title>About Forums</title>
		<link>https://objectuser.wordpress.com/2011/10/05/about-forums/</link>
					<comments>https://objectuser.wordpress.com/2011/10/05/about-forums/#respond</comments>
		
		<dc:creator><![CDATA[objectuser]]></dc:creator>
		<pubDate>Wed, 05 Oct 2011 16:44:32 +0000</pubDate>
				<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">http://objectuser.wordpress.com/?p=371</guid>

					<description><![CDATA[Search, email, social media, forums. These are some of the core uses of the Internet today. And some of the most advanced technology has gone into each one. Google Search is amazing. Gmail is a revolution. Facebook is the #1 destination on the web today. And forums &#8230; well, they&#8217;ve not kept up. Products like [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Search, email, social media, forums. These are some of the core uses of the Internet today. And some of the most advanced technology has gone into each one. Google Search is amazing. Gmail is a revolution. Facebook is the #1 destination on the web today. And forums &#8230; well, they&#8217;ve not kept up.</p>
<p>Products like vBulletin get the job done, but are hardly modern with their clunky web 1.0 interfaces. It&#8217;s also relatively expensive and complicated to get going with vBulletin, with the cost of the software, getting it hosted, installed and setup the way you want. That can easily run you over $200 a year, even for a small forum with a few users. However, you can customize vBulletin as much as you like, as long as you are willing to maintain those customizations, which is not for the casual forum administrator.</p>
<p>Other online solutions have made the setup easy. But their forum software is terrible. You can&#8217;t create a community there. You&#8217;re just one forum among the many. No since of membership or differentiation. And you&#8217;re usually stuck with their colors and layout.</p>
<p>It&#8217;s time forums moved into the modern era.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://objectuser.wordpress.com/2011/10/05/about-forums/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:content url="https://1.gravatar.com/avatar/770607414278dd771194721b83b2ac702bd954edc98ce53797cf8324bfe57eb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">objectuser</media:title>
		</media:content>
	</item>
		<item>
		<title>GWT Bean Validation How-To</title>
		<link>https://objectuser.wordpress.com/2011/09/12/gwt-bean-validation-how-to/</link>
					<comments>https://objectuser.wordpress.com/2011/09/12/gwt-bean-validation-how-to/#comments</comments>
		
		<dc:creator><![CDATA[objectuser]]></dc:creator>
		<pubDate>Mon, 12 Sep 2011 19:05:54 +0000</pubDate>
				<category><![CDATA[GWT]]></category>
		<guid isPermaLink="false">http://objectuser.wordpress.com/?p=350</guid>

					<description><![CDATA[There doesn&#8217;t appear to be a recent &#8220;how-to&#8221; on setting up GWT Bean Validation for a GWT 2.4 project.  In this post, I&#8217;ll let you know what I&#8217;m doing and then ask you for your feedback on how I might do it better. The idea is to follow the Validation sample that comes with the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>There doesn&#8217;t appear to be a recent &#8220;how-to&#8221; on setting up GWT Bean Validation for a GWT 2.4 project.  In this post, I&#8217;ll let you know what I&#8217;m doing and then ask you for your feedback on how I might do it better.</p>
<p>The idea is to follow the Validation sample that comes with the GWT 2.4 distribution.  The key items follow.</p>
<h2>Inherit the Hibernate Validator</h2>
<p>You need this in your gwt.xml file:</p>
<pre class="brush: xml; title: ; notranslate">
  &lt;entry-point class='com.google.gwt.sample.validation.client.Validation' /&gt;
</pre>
<h2>Setup the Validation Factory</h2>
<p>Also in your gwt.xml, you need:</p>
<pre class="brush: xml; title: ; notranslate">
  &lt;replace-with
    class=&quot;com.google.gwt.sample.validation.client.SampleValidatorFactory&quot;&gt;
    &lt;when-type-is class=&quot;javax.validation.ValidatorFactory&quot; /&gt;
  &lt;/replace-with&gt;
</pre>
<p>This is the factory that&#8217;s used when you build the validator.</p>
<p>Something else in that file is the code for setting up your messages. That&#8217;s optional: you can also specify your messages in your validation annotations. Refer to the <a href="http://docs.jboss.org/hibernate/validator/4.0.1/reference/en/html_single/">Bean Validation documentation</a> on what you should do in your case.</p>
<h2>Setup for Deployment</h2>
<p>You need the two validation-related libraries in your WEB-INF/lib directory:</p>
<ul>
<li>validation-api-1.0.0.GA.jar</li>
<li>hibernate-validator-4.1.0.Final.jar</li>
</ul>
<p>Then in your compile path, you need the two sources libraries:</p>
<ul>
<li>validation-api-1.0.0.GA-sources.jar</li>
<li>hibernate-validator-4.1.0.Final-sources.jar</li>
</ul>
<p>You can also put these in your WEB-INF/lib directory, but they&#8217;re not needed at runtime, only during the GWT compile phase.  This could be important if you&#8217;re using Google App Engine, where every added JAR lengthens your startup time.</p>
<h2>Give it a Go</h2>
<p>The rest is just applying the proper annotations and running the validator on your objects.  See the ValidationView.java file in the sample application for an example of this.  There are classes annotated with the validations from the framework in the shared sub-directory of the sample application.</p>
<h2>GIN</h2>
<p>I use Google GIN in my GWT application.  I currently don&#8217;t know the best &#8220;GIN way&#8221; to setup the validations.  I just have GIN create my validator instead of doing it in my code:</p>
<pre class="brush: java; title: ; notranslate">
    @Provides
    @Singleton
    Validator createValidator() {
        return Validation.buildDefaultValidatorFactory().getValidator();
    }
</pre>
<p>I imagine there&#8217;s a better way, one that would replace the replace-with facility in the gwt.xml, but I don&#8217;t know what that is yet.</p>
<h2>Feedback</h2>
<p>I haven&#8217;t found good documentation on setting this up.  This post shows what works for me.  But it certainly may not be the best way to set things up.  If you have better information, please let me know.  I appreciate your feedback.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://objectuser.wordpress.com/2011/09/12/gwt-bean-validation-how-to/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		
		<media:content url="https://1.gravatar.com/avatar/770607414278dd771194721b83b2ac702bd954edc98ce53797cf8324bfe57eb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">objectuser</media:title>
		</media:content>
	</item>
		<item>
		<title>Apache Shiro on Google App Engine</title>
		<link>https://objectuser.wordpress.com/2011/06/30/apache-shiro-on-google-app-engine/</link>
					<comments>https://objectuser.wordpress.com/2011/06/30/apache-shiro-on-google-app-engine/#comments</comments>
		
		<dc:creator><![CDATA[objectuser]]></dc:creator>
		<pubDate>Thu, 30 Jun 2011 12:54:38 +0000</pubDate>
				<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[GWT]]></category>
		<guid isPermaLink="false">http://objectuser.wordpress.com/?p=324</guid>

					<description><![CDATA[I had previously used a Spring-centered stack in Google App Engine.  These days I&#8217;m on more of a Google Guice kick.  There are some nice advantages to Guice, but some drawbacks as well.  One of the latter is the lack of an out-of-the-box integrated security solution. I am currently using Apache Shiro wired in with [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I had previously used a Spring-centered stack in Google App Engine.  These days I&#8217;m on more of a <a href="http://code.google.com/p/google-guice/">Google Guice</a> kick.  There are some nice advantages to Guice, but some drawbacks as well.  One of the latter is the lack of an out-of-the-box integrated security solution. I am currently using <a href="http://shiro.apache.org/">Apache Shiro</a> wired in with Guice as my security solution.  In this post, I&#8217;ll tell you how to do the same.</p>
<h2>Getting Started</h2>
<p>If you want to setup Shiro with Guice, you&#8217;ll need <a href="http://shiro.apache.org/download.html">Shiro</a> (I&#8217;m using 1.1.0) and <a href="http://code.google.com/p/google-guice/downloads/list">Guice</a> (I&#8217;m using 3.0).  Also, this post just tells you how to get started.  You should read all of the <a href="http://shiro.apache.org/reference.html">Shiro Reference Manual</a> so you can apply Shiro appropriately to your situation.  Only then can you have confidence your app is secure.</p>
<p>As always, your feedback is appreciated.  If I&#8217;m doing something wrong, please let me know!</p>
<h2>Shiro Realm</h2>
<p>To adapt Shiro to your application, the first thing you need is to implement a &#8220;realm&#8221;.  The realm is the core adaptation mechanism between Shiro and your particular datasource (where  you store your authentication and authorization information).  This is a straightforward process: just follow the documentation, perhaps extending <em><a href="http://shiro.apache.org/static/current/apidocs/org/apache/shiro/realm/AuthorizingRealm.html">AuthorizingRealm</a></em>, which is the logical extension point if you&#8217;re providing authentication and authorization context.  You might consider using <em>SimpleAuthorizationInfo</em> and <em>SimpleAccount</em> if you just need basic authentication and authorization in your realm.</p>
<p>The following is a simple realm example. The <a href="http://shiro.apache.org/realm.html">reference manual</a> has information on writing a better realm than what you see here.  For example, you may want to use a <a href="http://shiro.apache.org/static/current/apidocs/org/apache/shiro/authc/credential/HashedCredentialsMatcher.html">HashedCredentialsMatcher</a> instead of just matching clear character arrays.</p>
<pre class="brush: java; title: ; notranslate">
public class MyRealm extends AuthorizingRealm {

    private static Logger logger = Logger.getLogger(MyRealm.class.getName());

    private MySecurityManagerService mySecurityManagerService;

    @Inject
    public MyRealm(MySecurityManagerService mySecurityManagerService) {
        // This is the thing that knows how to find user creds and roles
        this.mySecurityManagerService = mySecurityManagerService;
    }

    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {

        String username = (String) principalCollection.getPrimaryPrincipal();

        // Find the thing that stores your user's roles.
        MyPrincipal principal = mySecurityManagerService.findMyPrincipalByUsername(username);
        if (principal == null) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine(&quot;Principal not found for authorizing user with username: &quot; + username);
            }
            return null;
        } else {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine(String.format(&quot;Authoriziong user %s with roles: %s&quot;, username, principal.getRoles()));
            }
            SimpleAuthorizationInfo result = new SimpleAuthorizationInfo(principal.getRoles());
            return result;
        }
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken)
            throws AuthenticationException {

        UsernamePasswordToken usernamePasswordToken = (UsernamePasswordToken) authenticationToken;
        if (usernamePasswordToken.getUsername() == null || usernamePasswordToken.getUsername().isEmpty()) {
            throw new AuthenticationException(&quot;Authentication failed&quot;);
        }

        // Find the thing that stores your user's credentials.  This may be the same or different than
        // the thing that stores the roles.
        MyPrincipal principal = mySecurityManagerService.findMyPrincipalByUsername(usernamePasswordToken.getUsername());
        if (principal == null) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine(&quot;Principal not found for user with username: &quot; + usernamePasswordToken.getUsername());
            }
            return null;
        }

        if (logger.isLoggable(Level.FINE)) {
            logger.fine(&quot;Principal found for authenticating user with username: &quot; + usernamePasswordToken.getUsername());
        }

        return new SimpleAccount(principal.getUsername(), principal.getPassword(), getName(),
                principal.getRoles(), new HashSet());
    }
}
</pre>
<p>That should get you started anyway.</p>
<h2>Shiro Filter</h2>
<p>Shiro has something of it&#8217;s own mini dependency injection facility with the <em><a href="http://shiro.apache.org/static/current/apidocs/org/apache/shiro/web/servlet/IniShiroFilter.html">IniShiroFilter</a></em>.  There is good documentation on that, and I think it might be the default configuration facility for most people using Shiro.  However, if you&#8217;re using Guice, that&#8217;s not the way you want to go.  You want to leverage Guice to wire everything together, and just do in Shiro what Shiro is meant for: security.</p>
<p>So you need another, more basic, filter.  Shiro could have just provided such a basic, essential module.  But they don&#8217;t.  I don&#8217;t know why.  Nevertheless, it&#8217;s easy to make your own.  Really easy.  Prepare yourself.  Here it is:</p>
<pre class="brush: java; title: ; notranslate">
@Singleton
public class ShiroFilter extends AbstractShiroFilter {

	@Inject
	public ShiroFilter(WebSecurityManager webSecurityManager) {
		setSecurityManager(webSecurityManager);
	}
}
</pre>
<p>Once you have your mind around that, you&#8217;ll need to do yourself some AOP.</p>
<h2>Guice Interceptor</h2>
<p>Shiro uses AOP to intercept method invocations for access control. Generally, that&#8217;s what you want: it&#8217;s non-intrusive and extensible. But it doesn&#8217;t use standard APIs to do that. I don&#8217;t know why. Guice, on the other hand, uses the AOP Alliance API for interception. So you need to make the one fit into the other.</p>
<p>The APIs are very similar, though (again, why not just use the AOP Alliance APIs? &#8230;), so it&#8217;s easy to adapt them:</p>
<pre class="brush: java; title: ; notranslate">
public class ShiroMethodInterceptor implements MethodInterceptor {

	private RoleAnnotationMethodInterceptor roleAnnotationMethodInterceptor = new RoleAnnotationMethodInterceptor();

	@Override
	public Object invoke(MethodInvocation methodInvocation) throws Throwable {
		return roleAnnotationMethodInterceptor.invoke(new ShiroMethodInvocation(methodInvocation));
	}

	private static class ShiroMethodInvocation implements org.apache.shiro.aop.MethodInvocation {

		private MethodInvocation methodInvocation;

		public ShiroMethodInvocation(MethodInvocation methodInvocation) {
			this.methodInvocation = methodInvocation;
		}
...
</pre>
<p>Easy stuff, right?</p>
<h2>Wiring it All Together</h2>
<p>Shiro is very modular.  And if you&#8217;re using the default configuration, they really take care of things for you.  But who does that?  Not me.  So that means you need to assemble the parts you need for your particular environment.  This includes:</p>
<ul>
<li>Creating a Realm for your particular environment</li>
<li>Selecting a session manager</li>
<li>Selecting a remember-me manager</li>
<li>Selecting a SecurityManager and telling it about your realm, session manager and remember-me manager</li>
</ul>
<p>You should know what all of those things are because you should have read the <a href="http://shiro.apache.org/reference.html">Shiro documentation</a>, which is not bad at all.  I created a custom realm and then did the following inside one of my Guice modules:</p>
<pre class="brush: java; title: ; notranslate">
public class MyModule extends AbstractModule {

	@Override
	protected void configure() {
		...
		bind(Realm.class).to(MyRealm.class);
		bindInterceptor(Matchers.any(), Matchers.annotatedWith(RequiresRoles.class),
		        new ShiroMethodInterceptor());
	}

	@Provides
	@Singleton
	WebSecurityManager provideSecurityManager(Realm realm, SessionManager sessionManager, RememberMeManager rememberMeManager) {
		DefaultWebSecurityManager result = new DefaultWebSecurityManager(realm);
		result.setSessionManager(sessionManager);
		result.setRememberMeManager(rememberMeManager);
		return result;
	}

	@Provides
	@Singleton
	SessionManager provideSessionManager() {
	    return new ServletContainerSessionManager();
	}

	@Provides
	@Singleton
	RememberMeManager provideRememberMeManager() {
	    return new CookieRememberMeManager();
	}
}
</pre>
<p>I love how easy it is to do AOP in Guice.  So nice.</p>
<p>In Google App Engine, it&#8217;s important to use the <em>ServletContainerSessionManager</em> instead of something like <em>DefaultWebSessionManager</em> because the latter tries to start threads, which GAE doesn&#8217;t care for at all.</p>
<p>The last thing you need to wire in is that filter, so Shiro will actually get involved in your web requests.  I again do that with Guice:</p>
<pre class="brush: java; title: ; notranslate">
public class MyServletModule extends ServletModule {

	@Override
	protected void configureServlets() {
		filter(&quot;/*&quot;).through(ShiroFilter.class);
	}
}
</pre>
<p>To make that work, you need to have <a href="http://code.google.com/docreader/#p=google-guice&amp;s=google-guice&amp;t=GoogleAppEngine">configured Guice in your web.xml</a>.</p>
<h2>Securing Services</h2>
<p>Authentication with Shiro is nice and simple.  The <a href="http://shiro.apache.org/10-minute-tutorial.html">10 Minute Tutorial</a> will get you started. In the simplest case might do something like this:</p>
<pre class="brush: java; title: ; notranslate">
        Subject subject = SecurityUtils.getSubject();
        UsernamePasswordToken token = new UsernamePasswordToken(username, password);
        token.setRememberMe(true);
        try {
            subject.login(token);
        } catch (AuthenticationException ae) {
            // handle failed logins here ... see the docs for more exceptions
        }
</pre>
<p>Authorization is even easier.  If you&#8217;re doing something basic, you will probably want some role-based security on your services. Shiro provides nice APIs for checking roles and permissions. I currently only care about roles. And that&#8217;s why we setup that aspect. To add role access control to your service method (on the server side of course!), just do something like this:</p>
<pre class="brush: java; title: ; notranslate">
    @RequiresRoles(&quot;importantRole&quot;)
    public void doSomethingImportant(...) {
    ...
</pre>
<p>I&#8217;m confident most everyone reading this knows that checking permissions on the client in a web app is not enough. So you need to do your security on the server side. Once something is on the client computer all bets are off!</p>
<p>In my app, I return some data useful for predicating particular permissions so I can toggle buttons, show panels, etc, on the client. But I do all of that an more on the server.</p>
<h2>Conclusion</h2>
<p>I think Apache Shiro is a good choice for adding security to a Guice-based app.  In particular it&#8217;s working well for me in Google App Engine with a GWT front-end.  I hope this guide helps some if you&#8217;re working a similar environment.  As always, if you see something I&#8217;m doing wrong, let me know!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://objectuser.wordpress.com/2011/06/30/apache-shiro-on-google-app-engine/feed/</wfw:commentRss>
			<slash:comments>24</slash:comments>
		
		
		
		<media:content url="https://1.gravatar.com/avatar/770607414278dd771194721b83b2ac702bd954edc98ce53797cf8324bfe57eb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">objectuser</media:title>
		</media:content>
	</item>
		<item>
		<title>Guice Persist with JDO</title>
		<link>https://objectuser.wordpress.com/2011/06/21/guice-persist-with-jdo/</link>
					<comments>https://objectuser.wordpress.com/2011/06/21/guice-persist-with-jdo/#comments</comments>
		
		<dc:creator><![CDATA[objectuser]]></dc:creator>
		<pubDate>Wed, 22 Jun 2011 02:57:52 +0000</pubDate>
				<category><![CDATA[Google App Engine]]></category>
		<guid isPermaLink="false">http://objectuser.wordpress.com/?p=316</guid>

					<description><![CDATA[Guice Persist is the evolution of warp-persist into Guice 3.0.  It comes stock with JPA integration, but nothing so far for JDO. Fortunately, the APIs for JPA and JDO follow similar patterns.  This post contains general guidance about adding Guice Persist support for JDO, with the goal of using Guice Persist in Google App Engine. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="http://code.google.com/p/google-guice/wiki/GuicePersist">Guice Persist</a> is the evolution of warp-persist into Guice 3.0.  It comes stock with <a href="http://code.google.com/p/google-guice/wiki/JPA">JPA integration</a>, but nothing so far for JDO. Fortunately, the APIs for JPA and JDO follow similar patterns.  This post contains general guidance about adding Guice Persist support for JDO, with the goal of using Guice Persist in Google App Engine. The largest caveat is that I don&#8217;t use the finder support provided by Guice Persist.  I was mostly wanting the declarative transaction support.  So I didn&#8217;t spend any time trying to get the finder support to work.</p>
<h2>Add the JAR</h2>
<p>You&#8217;ll need to add guice-persist.jar to your classpath.  It&#8217;s part of the Guice 3.0 distribution.</p>
<h2>Get the Source</h2>
<p>The source for all of Google Guice is available <a href="http://code.google.com/p/google-guice/source/checkout">here</a>.  You&#8217;ll specifically want the items in the package <em>com.google.inject.persist.jpa</em>in the extensions module. Copy that somewhere into your work area, renaming the package as appropriate.  You&#8217;ll have a lot of compile errors, but that&#8217;s to be expected.</p>
<h2>Replace JPA Stuff with JDO Stuff</h2>
<p>Now you need to start hacking.</p>
<p>JDO uses <em>PersistenceManager</em> where JPA uses <em>EntityManager</em>.  So first replace occurrences <em>EntityManager</em> with <em>PersistenceManager</em>.</p>
<p>Next, replace occurrences of &#8220;Jpa&#8221; with &#8220;Jdo&#8221; and &#8220;jpa&#8221; with &#8220;jdo&#8221;.</p>
<p>We have a slightly different syntax for getting the current transaction.  Replace:</p>
<pre class="brush: java; title: ; notranslate">EntityTransaction txn = em.getTransaction();</pre>
<p>with</p>
<pre class="brush: java; title: ; notranslate">Transaction txn = pm.currentTransaction();</pre>
<p>The source uses the <em>@Nullable</em> annotation, which is internal to the Guice package. So I just removed it. The same goes for the <em>Preconditions</em> and <em>Lists</em> utilities: remove the former and use <em>new ArrayList&lt;Class&lt;?&gt;&gt;()</em> for the latter.</p>
<p><span class="Apple-style-span" style="font-size:20px;font-weight:bold;">One Minor Improvement</span></p>
<p>Okay, maybe this is a major improvement.  But there&#8217;s a limitation in the way the injected <em>PersistenceManager</em> instance works: if your injected objects happen to be singletons (not created with each request), then you need to inject a <em>Provider&lt;PersistenceManager&gt;</em> instance instead.  I work in a web environment, and, since everything starts with a servlet, inevitably, things end up effectively being singletons.  (However, if I&#8217;m just missing something important, please let me know.  I&#8217;m still rather new to Guice).</p>
<p>So, if you don&#8217;t want to use providers, but still want Guice Persist to effectively manage transactions, use this trick.  In what becomes the JdoPersistService, make your get method look like this:</p>
<pre class="brush: java; title: ; notranslate">
    @Override
    public PersistenceManager get() {
        return (PersistenceManager) Proxy.newProxyInstance(PersistenceManager.class.getClassLoader(),
                new Class[] { PersistenceManager.class }, new InvocationHandler() {

                    @Override
                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                        if (!isWorking()) {
                            begin();
                        }

                        PersistenceManager pm = persistenceManager.get();

                        return method.invoke(pm, args);
                    }
                });
    }
</pre>
<p>With that small change, the injected persistence manager will never be &#8220;old&#8221;, but work in the context of a transaction no matter if it&#8217;s injected into a singleton or a new instances.</p>
<p>I think that&#8217;s about it.  If I&#8217;m missed a change, let me know and I&#8217;ll tell you what I did.  If I missed something fundamental, let me know so I can fix it in my code!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://objectuser.wordpress.com/2011/06/21/guice-persist-with-jdo/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		
		<media:content url="https://1.gravatar.com/avatar/770607414278dd771194721b83b2ac702bd954edc98ce53797cf8324bfe57eb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">objectuser</media:title>
		</media:content>
	</item>
		<item>
		<title>Gin Injector Methods</title>
		<link>https://objectuser.wordpress.com/2011/06/01/gin-injector-methods/</link>
					<comments>https://objectuser.wordpress.com/2011/06/01/gin-injector-methods/#respond</comments>
		
		<dc:creator><![CDATA[objectuser]]></dc:creator>
		<pubDate>Wed, 01 Jun 2011 12:19:09 +0000</pubDate>
				<category><![CDATA[GWT]]></category>
		<guid isPermaLink="false">http://objectuser.wordpress.com/?p=311</guid>

					<description><![CDATA[I must be slow, but I had a hard time understanding some of the Gin Tutorial. The tutorial states: Experienced GWT users will notice the similarity to the way GWT image bundles and messages are done: You simply create a method for each object type you want to create, and the an implementation of the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I must be slow, but I had a hard time understanding some of the <a href="http://code.google.com/p/google-gin/wiki/GinTutorial">Gin Tutorial</a>.</p>
<p>The tutorial states:</p>
<blockquote><p>Experienced GWT users will notice the similarity to the way GWT image bundles and messages are done: You simply create a method for each object type you want to create, and the an implementation of the interface gets generated for you <strong>at compile time</strong>.</p>
<p>Note that you only need to create injector methods for classes that you would directly access in your top-level initialization code, such as the UI classes to install in your <tt>RootPanel</tt>. You don&#8217;t need to create injector methods for lower-level classes that will be automatically injected. So for example, if Class <tt>A</tt> uses class <tt>B</tt> which uses class <tt>C</tt>, you only need to create an injector method for <tt>A</tt>, as the other classes <tt>B</tt> and <tt>C</tt> will automatically be injected into <tt>A</tt>.</p>
<p>In other words, injector methods provide a bridge between the Guice and non-Guice world.</p></blockquote>
<p>I still find that explanation confusing.  But I finally realized they&#8217;re trying to say that you only create methods for getting an object from the injector:</p>
<pre class="brush: java; title: ; notranslate">
MyClass myObject = injector.getMyClass();
</pre>
<p>That&#8217;s it.  So where in Guice you would do this:</p>
<pre class="brush: java; title: ; notranslate">
MyClass myObject = injector.getInstance(MyClass.class);
</pre>
<p>In Gin you do this:</p>
<pre class="brush: java; title: ; notranslate">
MyClass myObject = injector.getMyClass();
</pre>
<p>So if you need to call a method on the injector, create it. I ended up with one method.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://objectuser.wordpress.com/2011/06/01/gin-injector-methods/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:content url="https://1.gravatar.com/avatar/770607414278dd771194721b83b2ac702bd954edc98ce53797cf8324bfe57eb9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">objectuser</media:title>
		</media:content>
	</item>
	</channel>
</rss>
