<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FEJB3%2FSecurity</id>
		<title>Java/EJB3/Security - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FEJB3%2FSecurity"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/EJB3/Security&amp;action=history"/>
		<updated>2026-04-22T20:28:13Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/EJB3/Security&amp;diff=7741&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/EJB3/Security&amp;diff=7741&amp;oldid=prev"/>
				<updated>2010-06-01T06:50:19Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:50, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/EJB3/Security&amp;diff=7740&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/EJB3/Security&amp;diff=7740&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:45Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== EJB Tutorial from JBoss: ejb security ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
File: Calculator.java&lt;br /&gt;
/*&lt;br /&gt;
 * JBoss, Home of Professional Open Source.&lt;br /&gt;
 * Copyright 2006, Red Hat Middleware LLC, and individual contributors&lt;br /&gt;
 * as indicated by the @author tags. See the copyright.txt file in the&lt;br /&gt;
 * distribution for a full listing of individual contributors.&lt;br /&gt;
 *&lt;br /&gt;
 * This is free software; you can redistribute it and/or modify it&lt;br /&gt;
 * under the terms of the GNU Lesser General Public License as&lt;br /&gt;
 * published by the Free Software Foundation; either version 2.1 of&lt;br /&gt;
 * the License, or (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
 * Lesser General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
 * License along with this software; if not, write to the Free&lt;br /&gt;
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA&lt;br /&gt;
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.&lt;br /&gt;
 */&lt;br /&gt;
package org.jboss.tutorial.security.bean;&lt;br /&gt;
&lt;br /&gt;
public interface Calculator&lt;br /&gt;
{&lt;br /&gt;
   int add(int x, int y);&lt;br /&gt;
   int subtract(int x, int y);&lt;br /&gt;
   int divide(int x, int y);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: CalculatorBean.java&lt;br /&gt;
/*&lt;br /&gt;
 * JBoss, Home of Professional Open Source.&lt;br /&gt;
 * Copyright 2006, Red Hat Middleware LLC, and individual contributors&lt;br /&gt;
 * as indicated by the @author tags. See the copyright.txt file in the&lt;br /&gt;
 * distribution for a full listing of individual contributors.&lt;br /&gt;
 *&lt;br /&gt;
 * This is free software; you can redistribute it and/or modify it&lt;br /&gt;
 * under the terms of the GNU Lesser General Public License as&lt;br /&gt;
 * published by the Free Software Foundation; either version 2.1 of&lt;br /&gt;
 * the License, or (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
 * Lesser General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
 * License along with this software; if not, write to the Free&lt;br /&gt;
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA&lt;br /&gt;
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.&lt;br /&gt;
 */&lt;br /&gt;
package org.jboss.tutorial.security.bean;&lt;br /&gt;
import javax.annotation.security.RolesAllowed;&lt;br /&gt;
import javax.ejb.Stateless;&lt;br /&gt;
import javax.ejb.TransactionAttribute;&lt;br /&gt;
import javax.ejb.TransactionAttributeType;&lt;br /&gt;
import javax.annotation.security.PermitAll;&lt;br /&gt;
import javax.annotation.security.RolesAllowed;&lt;br /&gt;
import javax.ejb.Remote;&lt;br /&gt;
import org.jboss.annotation.security.SecurityDomain;&lt;br /&gt;
import org.jboss.annotation.security.SecurityDomain;&lt;br /&gt;
@Stateless&lt;br /&gt;
@SecurityDomain(&amp;quot;other&amp;quot;)&lt;br /&gt;
@Remote(Calculator.class)&lt;br /&gt;
public class CalculatorBean implements Calculator&lt;br /&gt;
{&lt;br /&gt;
   @PermitAll&lt;br /&gt;
   @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)&lt;br /&gt;
   public int add(int x, int y)&lt;br /&gt;
   {&lt;br /&gt;
      return x + y;&lt;br /&gt;
   }&lt;br /&gt;
   @RolesAllowed({&amp;quot;student&amp;quot;})&lt;br /&gt;
   public int subtract(int x, int y)&lt;br /&gt;
   {&lt;br /&gt;
      return x - y;&lt;br /&gt;
   }&lt;br /&gt;
   @RolesAllowed({&amp;quot;teacher&amp;quot;})&lt;br /&gt;
   public int divide(int x, int y)&lt;br /&gt;
   {&lt;br /&gt;
      return x / y;&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: Client.java&lt;br /&gt;
/*&lt;br /&gt;
 * JBoss, Home of Professional Open Source.&lt;br /&gt;
 * Copyright 2006, Red Hat Middleware LLC, and individual contributors&lt;br /&gt;
 * as indicated by the @author tags. See the copyright.txt file in the&lt;br /&gt;
 * distribution for a full listing of individual contributors.&lt;br /&gt;
 *&lt;br /&gt;
 * This is free software; you can redistribute it and/or modify it&lt;br /&gt;
 * under the terms of the GNU Lesser General Public License as&lt;br /&gt;
 * published by the Free Software Foundation; either version 2.1 of&lt;br /&gt;
 * the License, or (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
 * Lesser General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
 * License along with this software; if not, write to the Free&lt;br /&gt;
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA&lt;br /&gt;
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.&lt;br /&gt;
 */&lt;br /&gt;
package org.jboss.tutorial.security.client;&lt;br /&gt;
import java.util.Properties;&lt;br /&gt;
import javax.ejb.EJBAccessException;&lt;br /&gt;
import javax.naming.Context;&lt;br /&gt;
import javax.naming.InitialContext;&lt;br /&gt;
import org.jboss.tutorial.security.bean.Calculator;&lt;br /&gt;
/**&lt;br /&gt;
 * @version $Revision: 57207 $&lt;br /&gt;
 */&lt;br /&gt;
public class Client&lt;br /&gt;
{&lt;br /&gt;
   public static void main(String[] args) throws Exception&lt;br /&gt;
   {&lt;br /&gt;
      // Establish the proxy with an incorrect security identity&lt;br /&gt;
      Properties env = new Properties();&lt;br /&gt;
      env.setProperty(Context.SECURITY_PRINCIPAL, &amp;quot;kabir&amp;quot;);&lt;br /&gt;
      env.setProperty(Context.SECURITY_CREDENTIALS, &amp;quot;invalidpassword&amp;quot;);&lt;br /&gt;
      env.setProperty(Context.INITIAL_CONTEXT_FACTORY, &amp;quot;org.jboss.security.jndi.JndiLoginInitialContextFactory&amp;quot;);&lt;br /&gt;
      InitialContext ctx = new InitialContext(env);&lt;br /&gt;
      Calculator calculator = (Calculator) ctx.lookup(&amp;quot;CalculatorBean/remote&amp;quot;);&lt;br /&gt;
      System.out.println(&amp;quot;Kabir is a student.&amp;quot;);&lt;br /&gt;
      System.out.println(&amp;quot;Kabir types in the wrong password&amp;quot;);&lt;br /&gt;
      try&lt;br /&gt;
      {&lt;br /&gt;
         System.out.println(&amp;quot;1 + 1 = &amp;quot; + calculator.add(1, 1));&lt;br /&gt;
      }&lt;br /&gt;
      catch (EJBAccessException ex)&lt;br /&gt;
      {&lt;br /&gt;
         System.out.println(&amp;quot;Saw expected SecurityException: &amp;quot; + ex.getMessage());&lt;br /&gt;
      }&lt;br /&gt;
      System.out.println(&amp;quot;Kabir types in correct password.&amp;quot;);&lt;br /&gt;
      System.out.println(&amp;quot;Kabir does unchecked addition.&amp;quot;);&lt;br /&gt;
      // Re-establish the proxy with the correct security identity&lt;br /&gt;
      env.setProperty(Context.SECURITY_CREDENTIALS, &amp;quot;validpassword&amp;quot;);&lt;br /&gt;
      ctx = new InitialContext(env);&lt;br /&gt;
      calculator = (Calculator) ctx.lookup(&amp;quot;CalculatorBean/remote&amp;quot;);&lt;br /&gt;
      System.out.println(&amp;quot;1 + 1 = &amp;quot; + calculator.add(1, 1));&lt;br /&gt;
      System.out.println(&amp;quot;Kabir is not a teacher so he cannot do division&amp;quot;);&lt;br /&gt;
      try&lt;br /&gt;
      {&lt;br /&gt;
         calculator.divide(16, 4);&lt;br /&gt;
      }&lt;br /&gt;
      catch (javax.ejb.EJBAccessException  ex)&lt;br /&gt;
      {&lt;br /&gt;
         System.out.println(ex.getMessage());&lt;br /&gt;
      }&lt;br /&gt;
      System.out.println(&amp;quot;Students are allowed to do subtraction&amp;quot;);&lt;br /&gt;
      System.out.println(&amp;quot;1 - 1 = &amp;quot; + calculator.subtract(1, 1));&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
File: users.properties&lt;br /&gt;
kabir=validpassword&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== EJB Tutorial from JBoss: entity security ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File: AllEntity.java&lt;br /&gt;
/*&lt;br /&gt;
 * JBoss, Home of Professional Open Source.&lt;br /&gt;
 * Copyright 2006, Red Hat Middleware LLC, and individual contributors&lt;br /&gt;
 * as indicated by the @author tags. See the copyright.txt file in the&lt;br /&gt;
 * distribution for a full listing of individual contributors.&lt;br /&gt;
 *&lt;br /&gt;
 * This is free software; you can redistribute it and/or modify it&lt;br /&gt;
 * under the terms of the GNU Lesser General Public License as&lt;br /&gt;
 * published by the Free Software Foundation; either version 2.1 of&lt;br /&gt;
 * the License, or (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
 * Lesser General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
 * License along with this software; if not, write to the Free&lt;br /&gt;
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA&lt;br /&gt;
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.&lt;br /&gt;
 */&lt;br /&gt;
package org.jboss.tutorial.entity.security.bean;&lt;br /&gt;
import java.io.Serializable;&lt;br /&gt;
import javax.persistence.Entity;&lt;br /&gt;
import javax.persistence.GeneratedValue;&lt;br /&gt;
import javax.persistence.GenerationType;&lt;br /&gt;
import javax.persistence.Id;&lt;br /&gt;
@Entity&lt;br /&gt;
public class AllEntity implements Serializable&lt;br /&gt;
{&lt;br /&gt;
   @Id @GeneratedValue(strategy=GenerationType.AUTO)&lt;br /&gt;
   public int id;&lt;br /&gt;
   &lt;br /&gt;
   public String val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: SomeEntity.java&lt;br /&gt;
/*&lt;br /&gt;
 * JBoss, Home of Professional Open Source.&lt;br /&gt;
 * Copyright 2006, Red Hat Middleware LLC, and individual contributors&lt;br /&gt;
 * as indicated by the @author tags. See the copyright.txt file in the&lt;br /&gt;
 * distribution for a full listing of individual contributors.&lt;br /&gt;
 *&lt;br /&gt;
 * This is free software; you can redistribute it and/or modify it&lt;br /&gt;
 * under the terms of the GNU Lesser General Public License as&lt;br /&gt;
 * published by the Free Software Foundation; either version 2.1 of&lt;br /&gt;
 * the License, or (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
 * Lesser General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
 * License along with this software; if not, write to the Free&lt;br /&gt;
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA&lt;br /&gt;
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.&lt;br /&gt;
 */&lt;br /&gt;
package org.jboss.tutorial.entity.security.bean;&lt;br /&gt;
import java.io.Serializable;&lt;br /&gt;
import javax.persistence.Entity;&lt;br /&gt;
import javax.persistence.GeneratedValue;&lt;br /&gt;
import javax.persistence.GenerationType;&lt;br /&gt;
import javax.persistence.Id;&lt;br /&gt;
@Entity&lt;br /&gt;
public class SomeEntity implements Serializable&lt;br /&gt;
{&lt;br /&gt;
   @Id @GeneratedValue(strategy=GenerationType.AUTO)&lt;br /&gt;
   public int id;&lt;br /&gt;
   &lt;br /&gt;
   public String val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: StarEntity.java&lt;br /&gt;
/*&lt;br /&gt;
 * JBoss, Home of Professional Open Source.&lt;br /&gt;
 * Copyright 2006, Red Hat Middleware LLC, and individual contributors&lt;br /&gt;
 * as indicated by the @author tags. See the copyright.txt file in the&lt;br /&gt;
 * distribution for a full listing of individual contributors.&lt;br /&gt;
 *&lt;br /&gt;
 * This is free software; you can redistribute it and/or modify it&lt;br /&gt;
 * under the terms of the GNU Lesser General Public License as&lt;br /&gt;
 * published by the Free Software Foundation; either version 2.1 of&lt;br /&gt;
 * the License, or (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
 * Lesser General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
 * License along with this software; if not, write to the Free&lt;br /&gt;
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA&lt;br /&gt;
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.&lt;br /&gt;
 */&lt;br /&gt;
package org.jboss.tutorial.entity.security.bean;&lt;br /&gt;
import java.io.Serializable;&lt;br /&gt;
import javax.persistence.Entity;&lt;br /&gt;
import javax.persistence.GeneratedValue;&lt;br /&gt;
import javax.persistence.GenerationType;&lt;br /&gt;
import javax.persistence.Id;&lt;br /&gt;
@Entity&lt;br /&gt;
public class StarEntity  implements Serializable&lt;br /&gt;
{&lt;br /&gt;
   @Id @GeneratedValue(strategy=GenerationType.AUTO)&lt;br /&gt;
   public int id;&lt;br /&gt;
   &lt;br /&gt;
   public String val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: Stateless.java&lt;br /&gt;
/*&lt;br /&gt;
 * JBoss, Home of Professional Open Source.&lt;br /&gt;
 * Copyright 2006, Red Hat Middleware LLC, and individual contributors&lt;br /&gt;
 * as indicated by the @author tags. See the copyright.txt file in the&lt;br /&gt;
 * distribution for a full listing of individual contributors.&lt;br /&gt;
 *&lt;br /&gt;
 * This is free software; you can redistribute it and/or modify it&lt;br /&gt;
 * under the terms of the GNU Lesser General Public License as&lt;br /&gt;
 * published by the Free Software Foundation; either version 2.1 of&lt;br /&gt;
 * the License, or (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This software is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
 * Lesser General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
 * License along with this software; if not, write to the Free&lt;br /&gt;
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA&lt;br /&gt;
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.&lt;br /&gt;
 */&lt;br /&gt;
package org.jboss.tutorial.entity.security.bean;&lt;br /&gt;
import org.jboss.tutorial.entity.security.bean.AllEntity;&lt;br /&gt;
import org.jboss.tutorial.entity.security.bean.SomeEntity;&lt;br /&gt;
import org.jboss.tutorial.entity.security.bean.StarEntity;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * @author &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== EJB Tutorial from JBoss: ssl service ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File: ssl-service.xml&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;server&amp;gt;&lt;br /&gt;
   &amp;lt;!-- The server socket factory mbean to be used as attribute to socket invoker --&amp;gt;&lt;br /&gt;
   &amp;lt;!-- which uses the JaasSecurityDomain --&amp;gt;&lt;br /&gt;
   &amp;lt;mbean code=&amp;quot;org.jboss.remoting.security.domain.DomainServerSocketFactoryService&amp;quot;&lt;br /&gt;
      name=&amp;quot;jboss.remoting:service=ServerSocketFactory,type=SecurityDomainAdvanced&amp;quot;&lt;br /&gt;
      display-name=&amp;quot;SecurityDomain Server Socket Factory&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;attribute name=&amp;quot;SecurityDomain&amp;quot;&amp;gt;java:/jaas/SSLAdvanced&amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;depends&amp;gt;jboss.security:service=JaasSecurityDomain,domain=SSLAdvanced&amp;lt;/depends&amp;gt;&lt;br /&gt;
   &amp;lt;/mbean&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
     &amp;lt;mbean code=&amp;quot;org.jboss.security.plugins.JaasSecurityDomain&amp;quot;&lt;br /&gt;
         name=&amp;quot;jboss.security:service=JaasSecurityDomain,domain=SSLAdvanced&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;!-- This must correlate with the java:/jaas/SSL above --&amp;gt;&lt;br /&gt;
     &amp;lt;constructor&amp;gt;&lt;br /&gt;
        &amp;lt;arg type=&amp;quot;java.lang.String&amp;quot; value=&amp;quot;SSLAdvanced&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;/constructor&amp;gt;&lt;br /&gt;
     &amp;lt;!-- The location of the keystore&lt;br /&gt;
          resource: loads from the classloaders conf/ is the first classloader --&amp;gt;&lt;br /&gt;
     &amp;lt;attribute name=&amp;quot;KeyStoreURL&amp;quot;&amp;gt;localhost.keystore&amp;lt;/attribute&amp;gt;&lt;br /&gt;
     &amp;lt;attribute name=&amp;quot;KeyStorePass&amp;quot;&amp;gt;opensource&amp;lt;/attribute&amp;gt;&lt;br /&gt;
  &amp;lt;/mbean&amp;gt;&lt;br /&gt;
   &amp;lt;!-- The Connector is the core component of the remoting server service. --&amp;gt;&lt;br /&gt;
   &amp;lt;!-- It binds the remoting invoker (transport protocol, callback configuration, --&amp;gt;&lt;br /&gt;
   &amp;lt;!-- data marshalling, etc.) with the invocation handlers.  --&amp;gt;&lt;br /&gt;
   &amp;lt;mbean code=&amp;quot;org.jboss.remoting.transport.Connector&amp;quot;&lt;br /&gt;
          xmbean-dd=&amp;quot;org/jboss/remoting/transport/Connector.xml&amp;quot;&lt;br /&gt;
          name=&amp;quot;jboss.remoting:type=Connector,transport=socket3843,handler=ejb3&amp;quot;&amp;gt;&lt;br /&gt;
          display-name=&amp;quot;Socket transport Connector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;attribute name=&amp;quot;Configuration&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;config&amp;gt;&lt;br /&gt;
             &amp;lt;invoker transport=&amp;quot;sslsocket&amp;quot;&amp;gt;&lt;br /&gt;
               &amp;lt;attribute name=&amp;quot;dataType&amp;quot; isParam=&amp;quot;true&amp;quot;&amp;gt;invocation&amp;lt;/attribute&amp;gt;&lt;br /&gt;
               &amp;lt;attribute name=&amp;quot;marshaller&amp;quot; isParam=&amp;quot;true&amp;quot;&amp;gt;org.jboss.invocation.unified.marshall.InvocationMarshaller&amp;lt;/attribute&amp;gt;&lt;br /&gt;
               &amp;lt;attribute name=&amp;quot;unmarshaller&amp;quot; isParam=&amp;quot;true&amp;quot;&amp;gt;org.jboss.invocation.unified.marshall.InvocationUnMarshaller&amp;lt;/attribute&amp;gt;&lt;br /&gt;
               &amp;lt;!-- The following is for setting the server socket factory.  If want ssl support --&amp;gt;&lt;br /&gt;
               &amp;lt;!-- use a server socket factory that supports ssl.  The only requirement is that --&amp;gt;&lt;br /&gt;
               &amp;lt;!-- the server socket factory value must be an ObjectName, meaning the --&amp;gt;&lt;br /&gt;
               &amp;lt;!-- server socket factory implementation must be a MBean and also --&amp;gt;&lt;br /&gt;
               &amp;lt;!-- MUST implement the org.jboss.remoting.security.ServerSocketFactoryMBean interface. --&amp;gt;&lt;br /&gt;
               &amp;lt;attribute name=&amp;quot;serverSocketFactory&amp;quot;&amp;gt;jboss.remoting:service=ServerSocketFactory,type=SecurityDomainAdvanced&amp;lt;/attribute&amp;gt;&lt;br /&gt;
               &amp;lt;attribute name=&amp;quot;serverBindAddress&amp;quot;&amp;gt;${jboss.bind.address}&amp;lt;/attribute&amp;gt;&lt;br /&gt;
               &amp;lt;attribute name=&amp;quot;serverBindPort&amp;quot;&amp;gt;3843&amp;lt;/attribute&amp;gt;&lt;br /&gt;
            &amp;lt;/invoker&amp;gt;&lt;br /&gt;
            &amp;lt;handlers&amp;gt;&lt;br /&gt;
            &amp;lt;handler subsystem=&amp;quot;AOP&amp;quot;&amp;gt;org.jboss.aspects.remoting.AOPRemotingInvocationHandler&amp;lt;/handler&amp;gt;&lt;br /&gt;
            &amp;lt;/handlers&amp;gt;&lt;br /&gt;
         &amp;lt;/config&amp;gt;&lt;br /&gt;
      &amp;lt;/attribute&amp;gt;&lt;br /&gt;
      &amp;lt;depends&amp;gt;jboss.remoting:service=ServerSocketFactory,type=SecurityDomainAdvanced&amp;lt;/depends&amp;gt;&lt;br /&gt;
      &amp;lt;depends&amp;gt;jboss.aop:service=AspectDeployer&amp;lt;/depends&amp;gt;&lt;br /&gt;
   &amp;lt;/mbean&amp;gt;&lt;br /&gt;
&amp;lt;/server&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== security stateless ear ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setup security-domain For JBoss ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File: Employee.java&lt;br /&gt;
import javax.persistence.Entity;&lt;br /&gt;
import javax.persistence.EntityListeners;&lt;br /&gt;
import javax.persistence.GeneratedValue;&lt;br /&gt;
import javax.persistence.Id;&lt;br /&gt;
import javax.persistence.PostRemove;&lt;br /&gt;
@Entity&lt;br /&gt;
public class Employee implements java.io.Serializable {&lt;br /&gt;
  private int id;&lt;br /&gt;
  private String firstName;&lt;br /&gt;
  private String lastName;&lt;br /&gt;
  @Id&lt;br /&gt;
  @GeneratedValue&lt;br /&gt;
  public int getId() {&lt;br /&gt;
    return id;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  @PostRemove&lt;br /&gt;
  public void postRemove()&lt;br /&gt;
  {&lt;br /&gt;
     System.out.println(&amp;quot;@PostRemove&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(int id) {&lt;br /&gt;
    this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getFirstName() {&lt;br /&gt;
    return firstName;&lt;br /&gt;
  }&lt;br /&gt;
  public void setFirstName(String first) {&lt;br /&gt;
    this.firstName = first;&lt;br /&gt;
  }&lt;br /&gt;
  public String getLastName() {&lt;br /&gt;
    return lastName;&lt;br /&gt;
  }&lt;br /&gt;
  public void setLastName(String last) {&lt;br /&gt;
    this.lastName = last;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: EmployeeService.java&lt;br /&gt;
&lt;br /&gt;
import javax.annotation.security.RolesAllowed;&lt;br /&gt;
import javax.ejb.Stateful;&lt;br /&gt;
import javax.persistence.EntityManager;&lt;br /&gt;
import javax.persistence.PersistenceContext;&lt;br /&gt;
import org.jboss.annotation.security.SecurityDomain;&lt;br /&gt;
import javax.annotation.security.PermitAll;&lt;br /&gt;
import javax.annotation.security.RolesAllowed;&lt;br /&gt;
@Stateful&lt;br /&gt;
@SecurityDomain(&amp;quot;EmployeeServiceDB&amp;quot;)     &lt;br /&gt;
@RolesAllowed(&amp;quot;AUTHORIZED_MERCHANT&amp;quot;)&lt;br /&gt;
public class EmployeeService implements EmployeeServiceLocal, EmployeeServiceRemote {&lt;br /&gt;
  @PersistenceContext(unitName=&amp;quot;EmployeeService&amp;quot;)&lt;br /&gt;
  private EntityManager entityManager;&lt;br /&gt;
  public EmployeeService() {&lt;br /&gt;
  }&lt;br /&gt;
  @PermitAll&lt;br /&gt;
  //@RolesAllowed(&amp;quot;CHECK_FRAUD_ENABLED&amp;quot;)&lt;br /&gt;
  public void doAction() throws Exception {&lt;br /&gt;
    Employee emp = new Employee();&lt;br /&gt;
    emp.setId(1);&lt;br /&gt;
    entityManager.merge(emp);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: EmployeeServiceLocal.java&lt;br /&gt;
&lt;br /&gt;
import java.util.Collection;&lt;br /&gt;
import javax.ejb.Local;&lt;br /&gt;
@Local&lt;br /&gt;
public interface EmployeeServiceLocal {&lt;br /&gt;
    public void doAction()  throws Exception;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: EmployeeServiceRemote.java&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import java.util.Collection;&lt;br /&gt;
import javax.ejb.Remote;&lt;br /&gt;
@Remote&lt;br /&gt;
public interface EmployeeServiceRemote{&lt;br /&gt;
  public void doAction()  throws Exception;  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: jndi.properties&lt;br /&gt;
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory&lt;br /&gt;
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces&lt;br /&gt;
java.naming.provider.url=localhost:1099&lt;br /&gt;
&lt;br /&gt;
File: Main.java&lt;br /&gt;
import java.util.Date;&lt;br /&gt;
import javax.naming.InitialContext;&lt;br /&gt;
&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] a) throws Exception {&lt;br /&gt;
    EmployeeServiceRemote service = null;&lt;br /&gt;
    // Context compEnv = (Context) new InitialContext().lookup(&amp;quot;java:comp/env&amp;quot;);&lt;br /&gt;
    // service = (HelloService)new InitialContext().lookup(&amp;quot;java:comp/env/ejb/HelloService&amp;quot;);&lt;br /&gt;
    service = (EmployeeServiceRemote) new InitialContext().lookup(&amp;quot;EmployeeService/remote&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    service.doAction();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: roles.properties&lt;br /&gt;
user1=AUTHORIZED_MERCHANT&lt;br /&gt;
user2=UNAUTHORIZED_MERCHANT&lt;br /&gt;
&lt;br /&gt;
File: users.properties&lt;br /&gt;
user1=password&lt;br /&gt;
user2=password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ssl jaxws ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User Properties And Role Properties ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File: Employee.java&lt;br /&gt;
import javax.persistence.Entity;&lt;br /&gt;
import javax.persistence.EntityListeners;&lt;br /&gt;
import javax.persistence.GeneratedValue;&lt;br /&gt;
import javax.persistence.Id;&lt;br /&gt;
import javax.persistence.PostRemove;&lt;br /&gt;
@Entity&lt;br /&gt;
public class Employee implements java.io.Serializable {&lt;br /&gt;
  private int id;&lt;br /&gt;
  private String firstName;&lt;br /&gt;
  private String lastName;&lt;br /&gt;
  @Id&lt;br /&gt;
  @GeneratedValue&lt;br /&gt;
  public int getId() {&lt;br /&gt;
    return id;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  @PostRemove&lt;br /&gt;
  public void postRemove()&lt;br /&gt;
  {&lt;br /&gt;
     System.out.println(&amp;quot;@PostRemove&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  public void setId(int id) {&lt;br /&gt;
    this.id = id;&lt;br /&gt;
  }&lt;br /&gt;
  public String getFirstName() {&lt;br /&gt;
    return firstName;&lt;br /&gt;
  }&lt;br /&gt;
  public void setFirstName(String first) {&lt;br /&gt;
    this.firstName = first;&lt;br /&gt;
  }&lt;br /&gt;
  public String getLastName() {&lt;br /&gt;
    return lastName;&lt;br /&gt;
  }&lt;br /&gt;
  public void setLastName(String last) {&lt;br /&gt;
    this.lastName = last;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: EmployeeService.java&lt;br /&gt;
&lt;br /&gt;
import javax.annotation.security.RolesAllowed;&lt;br /&gt;
import javax.ejb.Stateful;&lt;br /&gt;
import javax.persistence.EntityManager;&lt;br /&gt;
import javax.persistence.PersistenceContext;&lt;br /&gt;
import org.jboss.annotation.security.SecurityDomain;&lt;br /&gt;
import javax.annotation.security.PermitAll;&lt;br /&gt;
import javax.annotation.security.RolesAllowed;&lt;br /&gt;
@Stateful&lt;br /&gt;
@SecurityDomain(&amp;quot;EmployeeServiceDB&amp;quot;)     &lt;br /&gt;
@RolesAllowed(&amp;quot;AUTHORIZED_MERCHANT&amp;quot;)&lt;br /&gt;
public class EmployeeService implements EmployeeServiceLocal, EmployeeServiceRemote {&lt;br /&gt;
  @PersistenceContext(unitName=&amp;quot;EmployeeService&amp;quot;)&lt;br /&gt;
  private EntityManager entityManager;&lt;br /&gt;
  public EmployeeService() {&lt;br /&gt;
  }&lt;br /&gt;
  @PermitAll&lt;br /&gt;
  //@RolesAllowed(&amp;quot;CHECK_FRAUD_ENABLED&amp;quot;)&lt;br /&gt;
  public void doAction() throws Exception {&lt;br /&gt;
    Employee emp = new Employee();&lt;br /&gt;
    emp.setId(1);&lt;br /&gt;
    entityManager.merge(emp);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: EmployeeServiceLocal.java&lt;br /&gt;
&lt;br /&gt;
import java.util.Collection;&lt;br /&gt;
import javax.ejb.Local;&lt;br /&gt;
@Local&lt;br /&gt;
public interface EmployeeServiceLocal {&lt;br /&gt;
    public void doAction()  throws Exception;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: EmployeeServiceRemote.java&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import java.util.Collection;&lt;br /&gt;
import javax.ejb.Remote;&lt;br /&gt;
@Remote&lt;br /&gt;
public interface EmployeeServiceRemote{&lt;br /&gt;
  public void doAction()  throws Exception;  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: jndi.properties&lt;br /&gt;
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory&lt;br /&gt;
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces&lt;br /&gt;
java.naming.provider.url=localhost:1099&lt;br /&gt;
&lt;br /&gt;
File: Main.java&lt;br /&gt;
import java.util.Date;&lt;br /&gt;
import javax.naming.InitialContext;&lt;br /&gt;
&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] a) throws Exception {&lt;br /&gt;
    EmployeeServiceRemote service = null;&lt;br /&gt;
    // Context compEnv = (Context) new InitialContext().lookup(&amp;quot;java:comp/env&amp;quot;);&lt;br /&gt;
    // service = (HelloService)new InitialContext().lookup(&amp;quot;java:comp/env/ejb/HelloService&amp;quot;);&lt;br /&gt;
    service = (EmployeeServiceRemote) new InitialContext().lookup(&amp;quot;EmployeeService/remote&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    service.doAction();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
File: roles.properties&lt;br /&gt;
user1=AUTHORIZED_MERCHANT&lt;br /&gt;
user2=UNAUTHORIZED_MERCHANT&lt;br /&gt;
&lt;br /&gt;
File: users.properties&lt;br /&gt;
user1=password&lt;br /&gt;
user2=password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>