01 /*
02 * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package javax.xml.ws;
27
28 import java.security.Principal;
29 import javax.xml.ws.handler.MessageContext;
30
31 /**
32 * A <code>WebServiceContext</code> makes it possible for
33 * a web service endpoint implementation class to access
34 * message context and security information relative to
35 * a request being served.
36 *
37 * Typically a <code>WebServiceContext</code> is injected
38 * into an endpoint implementation class using the
39 * <code>Resource</code> annotation.
40 *
41 * @since JAX-WS 2.0
42 *
43 * @see javax.annotation.Resource
44 **/
45 public interface WebServiceContext {
46
47 /**
48 * Returns the MessageContext for the request being served
49 * at the time this method is called. Only properties with
50 * APPLICATION scope will be visible to the application.
51 *
52 * @return MessageContext The message context.
53 *
54 * @throws IllegalStateException This exception is thrown
55 * if the method is called while no request is
56 * being serviced.
57 *
58 * @see javax.xml.ws.handler.MessageContext
59 * @see javax.xml.ws.handler.MessageContext.Scope
60 * @see java.lang.IllegalStateException
61 **/
62 public MessageContext getMessageContext();
63
64 /**
65 * Returns the Principal that identifies the sender
66 * of the request currently being serviced. If the
67 * sender has not been authenticated, the method
68 * returns <code>null</code>.
69 *
70 * @return Principal The principal object.
71 *
72 * @throws IllegalStateException This exception is thrown
73 * if the method is called while no request is
74 * being serviced.
75 *
76 * @see java.security.Principal
77 * @see java.lang.IllegalStateException
78 **/
79 public Principal getUserPrincipal();
80
81 /**
82 * Returns a boolean indicating whether the
83 * authenticated user is included in the specified
84 * logical role. If the user has not been
85 * authenticated, the method returns </code>false</code>.
86 *
87 * @param role A <code>String</code> specifying the name of the role
88 *
89 * @return a <code>boolean</code> indicating whether
90 * the sender of the request belongs to a given role
91 *
92 * @throws IllegalStateException This exception is thrown
93 * if the method is called while no request is
94 * being serviced.
95 **/
96 public boolean isUserInRole(String role);
97 }
|