Author: lindner
Date: Tue May 11 20:18:08 2010
New Revision: 943267
URL: http://svn.apache.org/viewvc?rev=943267&view=rev
Log:
SHINDIG-1299 jsecurity->shiro, move dep to server module
Added:
shindig/trunk/java/server/src/main/java/
shindig/trunk/java/server/src/main/java/org/
shindig/trunk/java/server/src/main/java/org/apache/
shindig/trunk/java/server/src/main/java/org/apache/shindig/
shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/
shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/
shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/SampleShiroRealm.java
- copied, changed from r943266,
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleRealm.java
shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/ShiroModule.java
Removed:
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleRealm.java
Modified:
shindig/trunk/java/server/pom.xml
shindig/trunk/java/server/src/main/webapp/WEB-INF/authorize.jsp
shindig/trunk/java/server/src/main/webapp/WEB-INF/web.xml
shindig/trunk/java/server/src/main/webapp/login.jsp
shindig/trunk/java/social-api/pom.xml
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/SampleModule.java
shindig/trunk/pom.xml
Modified: shindig/trunk/java/server/pom.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/server/pom.xml?rev=943267&r1=943266&r2=943267&view=diff
==============================================================================
--- shindig/trunk/java/server/pom.xml (original)
+++ shindig/trunk/java/server/pom.xml Tue May 11 20:18:08 2010
@@ -150,13 +150,17 @@
<artifactId>json</artifactId>
</dependency>
<dependency>
- <groupId>org.jsecurity</groupId>
- <artifactId>jsecurity</artifactId>
- </dependency>
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.shiro</groupId>
+ <artifactId>shiro-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ </dependency>
<!-- test -->
<dependency>
Copied:
shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/SampleShiroRealm.java
(from r943266,
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleRealm.java)
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/SampleShiroRealm.java?p2=shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/SampleShiroRealm.java&p1=shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleRealm.java&r1=943266&r2=943267&rev=943267&view=diff
==============================================================================
---
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleRealm.java
(original)
+++
shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/SampleShiroRealm.java
Tue May 11 20:18:08 2010
@@ -16,20 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.shindig.social.sample.oauth;
+package org.apache.shindig.sample.shiro;
import org.apache.shindig.social.sample.spi.JsonDbOpensocialService;
-import org.jsecurity.authc.AccountException;
-import org.jsecurity.authc.AuthenticationException;
-import org.jsecurity.authc.AuthenticationInfo;
-import org.jsecurity.authc.AuthenticationToken;
-import org.jsecurity.authc.SimpleAuthenticationInfo;
-import org.jsecurity.authc.UsernamePasswordToken;
-import org.jsecurity.authz.AuthorizationException;
-import org.jsecurity.authz.AuthorizationInfo;
-import org.jsecurity.authz.SimpleAuthorizationInfo;
-import org.jsecurity.realm.AuthorizingRealm;
-import org.jsecurity.subject.PrincipalCollection;
+import org.apache.shiro.authc.AccountException;
+import org.apache.shiro.authc.AuthenticationException;
+import org.apache.shiro.authc.AuthenticationInfo;
+import org.apache.shiro.authc.AuthenticationToken;
+import org.apache.shiro.authc.SimpleAuthenticationInfo;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.authz.AuthorizationException;
+import org.apache.shiro.authz.AuthorizationInfo;
+import org.apache.shiro.authz.SimpleAuthorizationInfo;
+import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.subject.PrincipalCollection;
import java.util.Set;
@@ -37,15 +37,14 @@ import com.google.common.collect.Immutab
import com.google.inject.Inject;
/**
- * A Sample Jsecurity Realm that uses the JSON DB to get passwords
+ * A Sample Shiro Realm that uses the JSON DB to get passwords
*
*/
-public class SampleRealm extends AuthorizingRealm {
- // HACK, jsecurity relies upon no-arg constructors..
+public class SampleShiroRealm extends AuthorizingRealm {
+ // HACK, apache.shiro relies upon no-arg constructors..
@Inject
private static JsonDbOpensocialService jsonDbService;
-
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken
token) throws AuthenticationException {
UsernamePasswordToken upToken = (UsernamePasswordToken) token;
String username = upToken.getUsername();
Added:
shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/ShiroModule.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/ShiroModule.java?rev=943267&view=auto
==============================================================================
---
shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/ShiroModule.java
(added)
+++
shindig/trunk/java/server/src/main/java/org/apache/shindig/sample/shiro/ShiroModule.java
Tue May 11 20:18:08 2010
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.shindig.sample.shiro;
+import com.google.inject.AbstractModule;
+
+public class ShiroModule extends AbstractModule {
+
+ protected void configure() {
+ // We do this so that jsecurity realms can get access to the jsondbservice
singleton
+ requestStaticInjection(SampleShiroRealm.class);
+ }
+}
Modified: shindig/trunk/java/server/src/main/webapp/WEB-INF/authorize.jsp
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/server/src/main/webapp/WEB-INF/authorize.jsp?rev=943267&r1=943266&r2=943267&view=diff
==============================================================================
--- shindig/trunk/java/server/src/main/webapp/WEB-INF/authorize.jsp (original)
+++ shindig/trunk/java/server/src/main/webapp/WEB-INF/authorize.jsp Tue May 11
20:18:08 2010
@@ -16,10 +16,10 @@ KIND, either express or implied. See th
specific language governing permissions and limitations
under the License.
-->
-<%@ page import="org.jsecurity.SecurityUtils" %>
+<%@ page import="org.apache.shiro.SecurityUtils" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-<%@ taglib prefix="jsec" uri="http://www.jsecurity.org/tags" %>
+<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ page import="net.oauth.OAuthConsumer" %>
<%@ page import="org.apache.shindig.social.opensocial.oauth.OAuthEntry" %>
@@ -63,7 +63,7 @@ under the License.
<title>Your Friendly OAuth Provider</title>
</head>
<body>
-Greetings <jsec:principal/>,<br/><br/>
+Greetings <shiro:principal/>,<br/><br/>
The following application wants to access your account information<br/><br/>
Modified: shindig/trunk/java/server/src/main/webapp/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/server/src/main/webapp/WEB-INF/web.xml?rev=943267&r1=943266&r2=943267&view=diff
==============================================================================
--- shindig/trunk/java/server/src/main/webapp/WEB-INF/web.xml (original)
+++ shindig/trunk/java/server/src/main/webapp/WEB-INF/web.xml Tue May 11
20:18:08 2010
@@ -33,37 +33,36 @@
org.apache.shindig.gadgets.DefaultGuiceModule:
org.apache.shindig.social.sample.SampleModule:
org.apache.shindig.gadgets.oauth.OAuthModule:
- org.apache.shindig.common.cache.ehcache.EhCacheModule
+ org.apache.shindig.common.cache.ehcache.EhCacheModule:
+ org.apache.shindig.sample.shiro.ShiroModule
</param-value>
</context-param>
<filter>
- <filter-name>JSecurityFilter</filter-name>
- <filter-class>org.jsecurity.web.servlet.JSecurityFilter</filter-class>
+ <filter-name>ShiroFilter</filter-name>
+
<filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>
-
- # The JSecurityFilter configuration is very powerful and
flexible, while still remaining succinct.
+ # The ShiroFilter configuration is very powerful and flexible,
while still remaining succinct.
# Please read the comprehensive example, with full comments
and explanations, in the JavaDoc:
#
#
http://www.jsecurity.org/api/org/jsecurity/web/servlet/JSecurityFilter.html
[main]
- shindigSampleRealm =
org.apache.shindig.social.sample.oauth.SampleRealm
+ shindigSampleRealm =
org.apache.shindig.sample.shiro.SampleShiroRealm
securityManager.realm = $shindigSampleRealm
[filters]
- jsecurity.loginUrl = /login.jsp
+ shiro.loginUrl = /login.jsp
[urls]
# The /login.jsp is not restricted to authenticated users
(otherwise no one could log in!), but
# the 'authc' filter must still be specified for it so it can
process that url's
# login submissions. It is 'smart' enough to allow those
requests through as specified by the
- # jsecurity.loginUrl above.
+ # shiro.loginUrl above.
/login.jsp = authc
/oauth/authorize/** = authc
- /remoting/** = authc, roles[b2bClient],
perms[remote:invoke:"lan,wan"]
</param-value>
</init-param>
@@ -76,12 +75,12 @@
<filter-mapping>
- <filter-name>JSecurityFilter</filter-name>
+ <filter-name>ShiroFilter</filter-name>
<url-pattern>/oauth/authorize</url-pattern>
</filter-mapping>
<filter-mapping>
- <filter-name>JSecurityFilter</filter-name>
+ <filter-name>ShiroFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
Modified: shindig/trunk/java/server/src/main/webapp/login.jsp
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/server/src/main/webapp/login.jsp?rev=943267&r1=943266&r2=943267&view=diff
==============================================================================
--- shindig/trunk/java/server/src/main/webapp/login.jsp (original)
+++ shindig/trunk/java/server/src/main/webapp/login.jsp Tue May 11 20:18:08 2010
@@ -16,10 +16,10 @@
~ specific language governing permissions and limitations
~ under the License.
--%>
-<%@ page import="org.jsecurity.SecurityUtils" %>
+<%@ page import="org.apache.shiro.SecurityUtils" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-<%@ taglib prefix="jsec" uri="http://www.jsecurity.org/tags" %>
+<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head>
@@ -28,7 +28,7 @@
<h2>Please Log in</h2>
-<jsec:guest>
+<shiro:guest>
<p>Try one of the accounts defined in canonicaldb.json</p>
@@ -82,10 +82,10 @@
</tbody>
</table>
<br/><br/>
-</jsec:guest>
+</shiro:guest>
-<c:out value="${jsecLoginFailure}" default=""/><br/>
+<c:out value="${shiroLoginFailure}" default=""/><br/>
<form action="" method="post">
Modified: shindig/trunk/java/social-api/pom.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/social-api/pom.xml?rev=943267&r1=943266&r2=943267&view=diff
==============================================================================
--- shindig/trunk/java/social-api/pom.xml (original)
+++ shindig/trunk/java/social-api/pom.xml Tue May 11 20:18:08 2010
@@ -131,10 +131,6 @@
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</dependency>
- <dependency>
- <groupId>org.jsecurity</groupId>
- <artifactId>jsecurity</artifactId>
- </dependency>
<!-- test -->
<dependency>
Modified:
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/SampleModule.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/SampleModule.java?rev=943267&r1=943266&r2=943267&view=diff
==============================================================================
---
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/SampleModule.java
(original)
+++
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/SampleModule.java
Tue May 11 20:18:08 2010
@@ -24,7 +24,6 @@ import org.apache.shindig.social.opensoc
import org.apache.shindig.social.opensocial.spi.MessageService;
import org.apache.shindig.social.opensocial.spi.PersonService;
import org.apache.shindig.social.sample.oauth.SampleOAuthDataStore;
-import org.apache.shindig.social.sample.oauth.SampleRealm;
import org.apache.shindig.social.sample.service.SampleContainerHandler;
import org.apache.shindig.social.sample.spi.JsonDbOpensocialService;
@@ -54,9 +53,6 @@ public class SampleModule extends Social
bind(OAuthDataStore.class).to(SampleOAuthDataStore.class);
-
- // We do this so that jsecurity realms can get access to the jsondbservice
singleton
- requestStaticInjection(SampleRealm.class);
}
@Override
@@ -66,5 +62,4 @@ public class SampleModule extends Social
handlers.add(SampleContainerHandler.class);
return handlers.build();
}
-
}
Modified: shindig/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/pom.xml?rev=943267&r1=943266&r2=943267&view=diff
==============================================================================
--- shindig/trunk/pom.xml (original)
+++ shindig/trunk/pom.xml Tue May 11 20:18:08 2010
@@ -1546,9 +1546,14 @@
<version>4.0.1</version>
</dependency>
<dependency>
- <groupId>org.jsecurity</groupId>
- <artifactId>jsecurity</artifactId>
- <version>0.9.0</version>
+ <groupId>org.apache.shiro</groupId>
+ <artifactId>shiro-web</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <version>1.5.6</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>