<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://luminoussheep.net/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Security_API</id>
	<title>Security API - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://luminoussheep.net/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Security_API"/>
	<link rel="alternate" type="text/html" href="https://luminoussheep.net/mediawiki/index.php?title=Security_API&amp;action=history"/>
	<updated>2026-04-16T19:07:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://luminoussheep.net/mediawiki/index.php?title=Security_API&amp;diff=73&amp;oldid=prev</id>
		<title>Martin: Created page with &quot;= programmatic security = * J2EE API for role membership &amp; user identity * Can use JAAS instead of Container Managed Security * for dynamic complex rules and policies  == JAAS...&quot;</title>
		<link rel="alternate" type="text/html" href="https://luminoussheep.net/mediawiki/index.php?title=Security_API&amp;diff=73&amp;oldid=prev"/>
		<updated>2021-09-14T21:35:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= programmatic security = * J2EE API for role membership &amp;amp; user identity * Can use JAAS instead of Container Managed Security * for dynamic complex rules and policies  == JAAS...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= programmatic security =&lt;br /&gt;
* J2EE API for role membership &amp;amp; user identity&lt;br /&gt;
* Can use JAAS instead of Container Managed Security&lt;br /&gt;
* for dynamic complex rules and policies&lt;br /&gt;
&lt;br /&gt;
== JAAS ==&lt;br /&gt;
* Authentication : [http://java.sun.com/j2se/1.5.0/docs/api/javax/security/auth/login/LoginContext.html LoginContext] object specifies who and callback handler to handle authentication process e.g. password/pin etc&lt;br /&gt;
** call void LoginContext.login() throws [http://java.sun.com/j2se/1.5.0/docs/api/javax/security/auth/login/LoginException.html LoginException]&lt;br /&gt;
* Configuration specifies what LoginModule to use&lt;br /&gt;
** Supports &amp;quot;stacked&amp;quot; modules - more than one&lt;br /&gt;
** configuration files contains - fully specified class name, authentication flag&lt;br /&gt;
&lt;br /&gt;
* [http://java.sun.com/j2se/1.4.2/docs/guide/security/jaas/tutorials/GeneralAcnAndAzn.html tutorial]&lt;br /&gt;
** [http://java.sun.com/j2se/1.4.2/docs/guide/security/jaas/tutorials/SampleAzn.java tutorial authentication code]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Authentication Flag ===&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;3&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
!Flag &lt;br /&gt;
!Description &lt;br /&gt;
!Continues on success &lt;br /&gt;
!Continues on failure &lt;br /&gt;
|- &lt;br /&gt;
| Sufficient &lt;br /&gt;
| If succeeds, login successful, no others need to pass &lt;br /&gt;
| No &lt;br /&gt;
| Yes &lt;br /&gt;
|- &lt;br /&gt;
| Requisite &lt;br /&gt;
| must succeed for login to be successful, others may still need to pass&lt;br /&gt;
| Yes &lt;br /&gt;
| No &lt;br /&gt;
|- &lt;br /&gt;
| Required &lt;br /&gt;
| must succeed for login to be successful, others may still need to pass &lt;br /&gt;
| Yes &lt;br /&gt;
| Yes &lt;br /&gt;
|- &lt;br /&gt;
| Optional &lt;br /&gt;
| not required for login to succeed &lt;br /&gt;
| Yes &lt;br /&gt;
| Yes &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== JAAS Authorisation ===&lt;br /&gt;
* successful login creates a [http://java.sun.com/j2se/1.5.0/docs/api/javax/security/auth/Subject.html Subject] represents the user&lt;br /&gt;
* Subject has a [http://java.sun.com/j2se/1.5.0/docs/api/java/security/Principal.html Principle] representing name, groups, roles, companies etc&lt;br /&gt;
* Principal used to control access - must be associated with the access control context&lt;br /&gt;
&lt;br /&gt;
=== javax.ejb.EJBContext ===&lt;br /&gt;
* java.security.Principal getCallerPrincipal() &lt;br /&gt;
* isCallerInRole(java.lang.String roleName) &lt;br /&gt;
*&amp;#039;&amp;#039; java.security.Identity getCallerIdentity()&amp;#039;&amp;#039; Deprecated - getCallerPrincipal&lt;br /&gt;
*&amp;#039;&amp;#039; isCallerInRole(java.security.Identity role)&amp;#039;&amp;#039; Deprecated- isCallerInRole&lt;br /&gt;
&lt;br /&gt;
=== javax.servlet.http.HttpServletRequest ===&lt;br /&gt;
* isRequestedSessionIdFromCookie()&lt;br /&gt;
* &amp;#039;&amp;#039;isRequestedSessionIdFromUrl()&amp;#039;&amp;#039; Deprecated (case change) see below&lt;br /&gt;
* isRequestedSessionIdFromURL()&lt;br /&gt;
* isRequestedSessionIdValid()&lt;br /&gt;
* isUserInRole(java.lang.String role)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== javax.annotation.security ===&lt;br /&gt;
* DeclareRoles&lt;br /&gt;
* DenyAll&lt;br /&gt;
* PermitAll&lt;br /&gt;
* RolesAllowed&lt;br /&gt;
* RunAs&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|- border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
! Annotation !! class !! method !! ejb or superclass !! servlet or web library&lt;br /&gt;
|-&lt;br /&gt;
| DeclareRoles || Y || Y || Y ||  &lt;br /&gt;
|-&lt;br /&gt;
| DenyAll      ||  || Y || Y ||  &lt;br /&gt;
|-&lt;br /&gt;
| PermitAll    || Y || Y || Y ||  &lt;br /&gt;
|-&lt;br /&gt;
| RolesAllowed || Y ||  || Y || Y &lt;br /&gt;
|-&lt;br /&gt;
| RunAs        || Y ||  || Y (only EJB) || Y (only servlet)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Security Policy&lt;br /&gt;
* http://java.sun.com/j2se/1.4.2/docs/guide/security/spec/security-spec.doc3.html&lt;br /&gt;
* http://java.sun.com/developer/technicalArticles/J2EE/security_annotation/&lt;/div&gt;</summary>
		<author><name>Martin</name></author>
	</entry>
</feed>