<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: Session-based web service with JBossWS?
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/stevecoh4">Steve Cohen</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/633138#633138">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>OK, I keep learning more stuff but it's not getting me where I want to be but I feel I'm getting close.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Here</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><a class="jive-link-external-small" href="http://download.oracle.com/docs/cd/E19879-01/819-3669/bnbyw/index.html" target="_blank">http://download.oracle.com/docs/cd/E19879-01/819-3669/bnbyw/index.html</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I find that the javax.annotation.security annotations can be placed on methods as well as classes.  Great, that is what I was missing.  Everything compiles, deploys without a hitch.  Alas, it doesn't work:  </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>package</b></font> org.javactivity.ws.ejb;
 
<font color="navy"><b>import</b></font> javax.annotation.security.PermitAll;
<font color="navy"><b>import</b></font> javax.annotation.security.RolesAllowed;
<font color="navy"><b>import</b></font> javax.ejb.Stateless;
<font color="navy"><b>import</b></font> javax.jws.HandlerChain;
<font color="navy"><b>import</b></font> javax.jws.WebService;
<font color="navy"><b>import</b></font> javax.jws.soap.SOAPBinding;
 
<font color="navy"><b>import</b></font> org.jboss.ejb3.annotation.SecurityDomain;
<font color="navy"><b>import</b></font> org.jboss.wsf.spi.annotation.WebContext;
<font color="navy"><b>import</b></font> org.slf4j.Logger;
<font color="navy"><b>import</b></font> org.slf4j.LoggerFactory;
 
@Stateless
 
@WebContext(
        contextRoot=<font color="red">"attrsws-ejb"</font>,
        urlPattern=<font color="red">"/*"</font>,
        authMethod = <font color="red">"BASIC"</font>,
        secureWSDLAccess = <font color="navy"><b>false</b></font>)
@SecurityDomain(value = <font color="red">"JBossWS"</font>)
 
@WebService(targetNamespace = <font color="red">"http://org.javactivity/MyService/"</font>,
portName=<font color="red">"MyServiceSOAP"</font>,
serviceName=<font color="red">"MyService"</font>,
endpointInterface=<font color="red">"org.javactivity.ws.ejb.MyServicePort"</font>)
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle = SOAPBinding.ParameterStyle.BARE)
@HandlerChain(file = <font color="red">"handlers.xml"</font>)
 
<font color="navy"><b>public</b></font> <font color="navy"><b>class</b></font> MyServicePortImpl <font color="navy"><b>implements</b></font> MyServicePort <font color="navy">{</font>
    <font color="navy"><b>private</b></font> <font color="navy"><b>static</b></font> <font color="navy"><b>final</b></font> Logger log = LoggerFactory.getLogger(MyServicePortImpl.class);
    <font color="navy"><b>private</b></font> <font color="navy"><b>static</b></font> <font color="navy"><b>int</b></font> nextSession = 0;
 
    @Override
    @PermitAll
    <font color="navy"><b>public</b></font> <font color="navy"><b>int</b></font> foo(UserTypeType usertype, String username, String key) <font color="navy">{</font>
        nextSession++;
        log.debug(<font color="red">"foo returning a value of {}"</font>, nextSession);
        <font color="navy"><b>return</b></font> nextSession;
    <font color="navy">}</font>
    @Override
    @RolesAllowed(<font color="red">"friend"</font>)
    <font color="navy"><b>public</b></font> <font color="navy"><b>int</b></font> login(UserIdentity identity) <font color="navy">{</font>
        nextSession++;
        log.debug(<font color="red">"Login returning a value of {}"</font>, nextSession);
        <font color="navy"><b>return</b></font> nextSession;
    <font color="navy">}</font>
<font color="navy">}</font>
 
</code></pre><p>If I supply a bad password, neither method allows access.  If I supply a good password, both methods allow access.  The annotations are not being recognized. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>What ELSE must I do to get these method permissions recognized by JBoss?</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/633138#633138">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>