You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@tomee.apache.org by bu...@apache.org on 2012/08/26 15:47:34 UTC
svn commit: r830186 - in /websites/staging/openejb/trunk: cgi-bin/ content/
content/examples-trunk/ content/examples-trunk/cdi-realm/
content/examples-trunk/cdi-realm/src/
content/examples-trunk/cdi-realm/src/main/
content/examples-trunk/cdi-realm/src/...
Author: buildbot
Date: Sun Aug 26 13:47:34 2012
New Revision: 830186
Log:
Staging update by buildbot for openejb
Added:
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/pom.xml (with props)
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/java/
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/java/org/
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/java/org/superbiz/
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/java/org/superbiz/AuthBean.java
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/META-INF/
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/META-INF/context.xml
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/WEB-INF/
websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/WEB-INF/beans.xml
Modified:
websites/staging/openejb/trunk/cgi-bin/ (props changed)
websites/staging/openejb/trunk/content/ (props changed)
websites/staging/openejb/trunk/content/examples-trunk/pom.xml
Propchange: websites/staging/openejb/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Aug 26 13:47:34 2012
@@ -1 +1 @@
-1377262
+1377439
Propchange: websites/staging/openejb/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Aug 26 13:47:34 2012
@@ -1 +1 @@
-1377262
+1377439
Added: websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/pom.xml
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/pom.xml
------------------------------------------------------------------------------
svn:mime-type = application/xml
Added: websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/java/org/superbiz/AuthBean.java
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/java/org/superbiz/AuthBean.java (added)
+++ websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/java/org/superbiz/AuthBean.java Sun Aug 26 13:47:34 2012
@@ -0,0 +1,54 @@
+/**
+ * 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.superbiz;
+
+import javax.enterprise.context.RequestScoped;
+import java.security.Principal;
+
+@RequestScoped
+public class AuthBean {
+
+ public Principal authenticate(final String username, String password) {
+ if (("userA".equals(username)||"userB".equals(username)) && "test".equals(password)) {
+ return new Principal() {
+ @Override
+ public String getName() {
+ return username;
+ }
+ @Override
+ public String toString() {
+ return username;
+ }
+ };
+ }
+ return null;
+ }
+
+
+ public boolean hasRole(Principal principal, String role) {
+ if (principal == null) {
+ return false;
+ }
+ if(principal.getName().equals("userA") && (role.equals("admin")||role.equals("user"))) {
+ return true;
+ }
+ if(principal.getName().equals("userB") && (role.equals("user"))) {
+ return true;
+ }
+ return false;
+ }
+}
Added: websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/META-INF/context.xml
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/META-INF/context.xml (added)
+++ websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/META-INF/context.xml Sun Aug 26 13:47:34 2012
@@ -0,0 +1,3 @@
+<Context>
+ <Realm cdi="true" className="org.apache.tomee.catalina.realm.LazyRealm" realmClass="org.superbiz.AuthBean" />
+</Context>
\ No newline at end of file
Added: websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/WEB-INF/beans.xml
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/WEB-INF/beans.xml (added)
+++ websites/staging/openejb/trunk/content/examples-trunk/cdi-realm/src/main/webapp/WEB-INF/beans.xml Sun Aug 26 13:47:34 2012
@@ -0,0 +1,18 @@
+<!--
+
+ 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.
+-->
+<beans />
Modified: websites/staging/openejb/trunk/content/examples-trunk/pom.xml
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/pom.xml (original)
+++ websites/staging/openejb/trunk/content/examples-trunk/pom.xml Sun Aug 26 13:47:34 2012
@@ -17,7 +17,7 @@
limitations under the License.
-->
<!--test 2-->
-<!-- $Rev: 1376776 $ $Date: 2012-08-23 23:33:21 +0000 (Thu, 23 Aug 2012) $ -->
+<!-- $Rev: 1377439 $ $Date: 2012-08-26 13:47:17 +0000 (Sun, 26 Aug 2012) $ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
@@ -47,6 +47,7 @@
<module>cdi-produces-disposes</module>
<module>cdi-produces-field</module>
<module>cdi-query</module>
+ <module>cdi-realm</module>
<module>change-jaxws-url</module>
<module>component-interfaces</module>
<module>client-resource-lookup-preview</module>