web/src/main/java/org/springframework/security/web/jaasapi/JaasApiIntegrationFilter.java
protected Subject obtainSubject(ServletRequest request) {
		Authentication authentication = SecurityContextHolder.getContext()
				.getAuthentication();
		if (logger.isDebugEnabled()) {
			logger.debug("Attempting to obtainSubject using authentication : "
					+ authentication);
		}
		if (authentication == null) {
			return null;
		}
		if (!authentication.isAuthenticated()) {
			return null;
		}
		if (!(authentication instanceof JaasAuthenticationToken)) {
			return null;
		}
		JaasAuthenticationToken token = (JaasAuthenticationToken) authentication;
		LoginContext loginContext = token.getLoginContext();
		if (loginContext == null) {
			return null;
		}
		return loginContext.getSubject();
	}
protected Subject obtainSubject(ServletRequest request) {
		Authentication authentication = SecurityContextHolder.getContext()
				.getAuthentication();
		if (logger.isDebugEnabled()) {
			logger.debug("Attempting to obtainSubject using authentication : "
					+ authentication);
		}
		if (authentication == null) {
			return null;
		}
		if (!authentication.isAuthenticated()) {
			return null;
		}
		if (!(authentication instanceof JaasAuthenticationToken)) {
			return null;
		}
		JaasAuthenticationToken token = (JaasAuthenticationToken) authentication;
		LoginContext loginContext = token.getLoginContext();
		if (loginContext == null) {
			return null;
		}
		return loginContext.getSubject();
	}
protected Subject obtainSubject ( ServletRequest request ) { Authentication authentication = SecurityContextHolder . getContext ( ) . getAuthentication ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Attempting to obtainSubject using authentication : " + authentication ) ; } if ( authentication == null ) { return null ; } if ( ! authentication . isAuthenticated ( ) ) { return null ; } if ( ! ( authentication instanceof JaasAuthenticationToken ) ) { return null ; } JaasAuthenticationToken token = ( JaasAuthenticationToken ) authentication ; LoginContext loginContext = token . getLoginContext ( ) ; if ( loginContext == null ) { return null ; } return loginContext . getSubject ( ) ; }
<p>
Obtains the <code>Subject</code> to run as or <code>null</code> if no
<code>Subject</code> is available.
</p>
<p>
The default implementation attempts to obtain the <code>Subject</code> from the
<code>SecurityContext</code>'s <code>Authentication</code>. If it is of type
<code>JaasAuthenticationToken</code> and is authenticated, the <code>Subject</code>
is returned from it. Otherwise, <code>null</code> is returned.
</p>

@param request the current <code>ServletRequest</code>
@return the Subject to run as or <code>null</code> if no <code>Subject</code> is
available.
<p > Obtains the <code > Subject< / code > to run as or <code > null< / code > if no <code > Subject< / code > is available . < / p > <p > The default implementation attempts to obtain the <code > Subject< / code > from the <code > SecurityContext< / code > s <code > Authentication< / code > . If it is of type <code > JaasAuthenticationToken< / code > and is authenticated the <code > Subject< / code > is returned from it . Otherwise <code > null< / code > is returned . < / p >