Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit 5a5015a

Browse files
committed
Updates related to principal handling
1 parent 8263c93 commit 5a5015a

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

src/main/doc/authenticationMechanism.asciidoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ The _secureResponse()_ method is provided to allow post processing on the respon
202202

203203
The _cleanSubject()_ is provided to allow for cleanup after a caller is logged out. For example, an authentication mechanism that stores state within a cookie can remove that cookie here.
204204

205-
The _HttpMessageContext_ interface defines methods that an _HttpAuthenticationMechanism_ can invoke to communicate with the JASPIC _ServerAuthModule_ (bridge module) that invokes it. The _HttpMessageContextWrapper_ provides an implementation of the interface, and can be used, in a manner similar to _HttpServletRequestWrapper_, to provide custom behavior. See javadoc for a detailed description of _HttpMessageContext_ and _HttpMessageContextWrapper_. See below for more on the JASPIC bridge module.
205+
The _HttpMessageContext_ interface defines methods that an _HttpAuthenticationMechanism_ can invoke to communicate with the JASPIC _ServerAuthModule_ (bridge module) that invokes it. The container MUST provide an implementation of the interface that supports the necessary container integrations.
206+
207+
The _HttpMessageContextWrapper_ class implements a wrapper can be used, in a manner similar to _HttpServletRequestWrapper_, to provide custom behavior.
208+
209+
See javadoc for a detailed description of _HttpMessageContext_ and _HttpMessageContextWrapper_. See below for more on the JASPIC bridge module.
206210

207211
=== Installation and Configuration
208212

src/main/doc/concepts.asciidoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,15 @@ An application server MAY provide a default mapping from caller principal names
184184
This specification defines a principal type called _CallerPrincipal_ to represent the identity of an application caller. Historically, application servers have used different principal types to represent an application's callers, and various Java EE specifications (e.g., JASPIC), provide abstractions to accomodate, "the container's representation of the caller principal".
185185

186186
This specification RECOMMENDS that Java EE application servers that rely on container-specific caller principal types derive those types by extending _CallerPrincipal_, so that portable applications can rely on a consistent representation of the caller principal.
187+
188+
However, we also distinguish here between a "container caller principal" and an "application caller principal", and explicitly allow for each to be represented by a different _Principal_ type.
189+
190+
The container caller principal is a _Principal_ that the container uses to represent a caller's identity. An implementation of this specification MAY choose any _Principal_ type for this purpose. The type chosen may carry additional information, or provide unique behaviors.
191+
192+
An application caller principal is a _Principal_ that an application, or an implementation of, e.g., an _HttpAuthenticationMechanism_, uses to represent a caller's identity. An application MAY choose any _Principal_ type for that purpose. The type chosen may carry additional information, or provide unique behaviors.
193+
194+
Because both containers and applications can have legitimate requirements for specific _Principal_ types to represent a caller, and those types may differ, it MUST be possible for the container to establish both the container's and the application's caller principal as the caller's identity; for example, by including both in a Subject representing the caller.
195+
196+
When both a container caller principal and an application caller principal are present, the value obtained by calling _getName()_ on both principals MUST be the same.
197+
198+
When no specific application caller principal is supplied during authentication, the caller's identity should be represented by a single principal, the container's caller principal.

src/main/doc/license.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ Status: Public Review +
157157
Release: May 2017
158158

159159
Copyright 2017 Oracle America, Inc. +
160-
500 Oracle Parkway, Redwood City, California 94065, U.S.A.
161-
160+
500 Oracle Parkway, Redwood City, California 94065, U.S.A. +
162161
All rights reserved.
163162

164163
NOTICE +

src/main/doc/securityContext.asciidoc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,19 @@ The _SecurityContext_ interface defines two methods that allow the application t
161161
----
162162
Principal getCallerPrincipal();
163163
164+
<T extends Principal>
165+
Set<T> getPrincipalsByType(Class<T> pType);
166+
164167
boolean isCallerInRole(String role);
165168
----
166169

167-
The _getCallerPrincipal()_ method retrieves the _Principal_ representing the caller.
170+
The _getCallerPrincipal()_ method retrieves the _Principal_ representing the caller. This is the container-specific representation of the caller principal, and the type may differ from the type of the caller principal originally established by an _HttpAuthenticationMechanism_. This method returns null for an unauthenticated caller. (Note that this behavior differs from the behavior of _EJBContext.getCallerPrincipal()_, which returns a principal with an null/empty name for an unauthenticated caller.)
171+
172+
The _getPrincipalsByType()_ method retrieves all principals of the given type. This method can be used to retrieve an application-specific caller principal established during authentication. This method is primarily useful in the case that the container's caller principal is a different type than the application caller principal, and the application needs specific information behavior available only from the application principal. This method returns an empty _Set_ if the caller is unauthenticated, or if the requested type is not found.
173+
174+
Where both a container caller principal and an application caller principal are present, the value returned by _getName()_ MUST be the same for both principals.
175+
176+
See the <<concepts.asciidoc#concepts,Concepts>> chapter for more information on principal handling.
168177

169178
The _isCallerInRole()_ method takes a String argument that represents the role that is to be tested for. It is undefined by this specification how the role determination is made, but the result MUST be the same as if the corresponding container-specific call had been made (i.e., _HttpServletRequest.isUserInRole()_, _EJBContext.isCallerInRole()_), and MUST be consistent with the result implied by other specifications that prescribe role-mapping behavior.
170179

0 commit comments

Comments
 (0)