signature:
public class RememberMeConfigurer { /** * Gets the { @ link RememberMeServices } or creates the { @ link RememberMeServices } .
 * @ param http the { @ link HttpSecurity } to lookup shared objects
 * @ param key the { @ link # key ( String ) }
 * @ return the { @ link RememberMeServices } to use
 * @ throws Exception */
private RememberMeServices getRememberMeServices ( H http , String key ) throws Exception { } }

implementation: if ( this . rememberMeServices != null ) { if ( this . rememberMeServices instanceof LogoutHandler && this . logoutHandler == null ) { this . logoutHandler = ( LogoutHandler ) this . rememberMeServices ; } return this . rememberMeServices ; } AbstractRememberMeServices tokenRememberMeServices = createRememberMeServices ( http , key ) ; tokenRememberMeServices . setParameter ( this . rememberMeParameter ) ; tokenRememberMeServices . setCookieName ( this . rememberMeCookieName ) ; if ( this . rememberMeCookieDomain != null ) { tokenRememberMeServices . setCookieDomain ( this . rememberMeCookieDomain ) ; } if ( this . tokenValiditySeconds != null ) { tokenRememberMeServices . setTokenValiditySeconds ( this . tokenValiditySeconds ) ; } if ( this . useSecureCookie != null ) { tokenRememberMeServices . setUseSecureCookie ( this . useSecureCookie ) ; } if ( this . alwaysRemember != null ) { tokenRememberMeServices . setAlwaysRemember ( this . alwaysRemember ) ; } tokenRememberMeServices . afterPropertiesSet ( ) ; this . logoutHandler = tokenRememberMeServices ; this . rememberMeServices = tokenRememberMeServices ; return tokenRememberMeServices ;


signature:
public class RememberMeConfigurer { /** * Creates the { @ link RememberMeServices } to use when none is provided . The result is
 * either { @ link PersistentTokenRepository } ( if a { @ link PersistentTokenRepository } is
 * specified , else { @ link TokenBasedRememberMeServices } .
 * @ param http the { @ link HttpSecurity } to lookup shared objects
 * @ param key the { @ link # key ( String ) }
 * @ return the { @ link RememberMeServices } to use
 * @ throws Exception */
private AbstractRememberMeServices createRememberMeServices ( H http , String key ) throws Exception { } }

implementation: return this . tokenRepository == null ? createTokenBasedRememberMeServices ( http , key ) : createPersistentRememberMeServices ( http , key ) ;


signature:
public class RememberMeConfigurer { /** * Creates { @ link TokenBasedRememberMeServices }
 * @ param http the { @ link HttpSecurity } to lookup shared objects
 * @ param key the { @ link # key ( String ) }
 * @ return the { @ link TokenBasedRememberMeServices } */
private AbstractRememberMeServices createTokenBasedRememberMeServices ( H http , String key ) { } }

implementation: UserDetailsService userDetailsService = getUserDetailsService ( http ) ; return new TokenBasedRememberMeServices ( key , userDetailsService ) ;


signature:
public class RememberMeConfigurer { /** * Creates { @ link PersistentTokenBasedRememberMeServices }
 * @ param http the { @ link HttpSecurity } to lookup shared objects
 * @ param key the { @ link # key ( String ) }
 * @ return the { @ link PersistentTokenBasedRememberMeServices } */
private AbstractRememberMeServices createPersistentRememberMeServices ( H http , String key ) { } }

implementation: UserDetailsService userDetailsService = getUserDetailsService ( http ) ; return new PersistentTokenBasedRememberMeServices ( key , userDetailsService , this . tokenRepository ) ;


signature:
public class RememberMeConfigurer { /** * Gets the { @ link UserDetailsService } to use . Either the explicitly configure
 * { @ link UserDetailsService } from { @ link # userDetailsService ( UserDetailsService ) } or
 * a shared object from { @ link HttpSecurity # getSharedObject ( Class ) } .
 * @ param http { @ link HttpSecurity } to get the shared { @ link UserDetailsService }
 * @ return the { @ link UserDetailsService } to use */
private UserDetailsService getUserDetailsService ( H http ) { } }

implementation: if ( this . userDetailsService == null ) { this . userDetailsService = http . getSharedObject ( UserDetailsService . class ) ; } if ( this . userDetailsService == null ) { throw new IllegalStateException ( "userDetailsService cannot be null. Invoke " + RememberMeConfigurer . class . getSimpleName ( ) + "#userDetailsService(UserDetailsService) or see its javadoc for alternative approaches." ) ; } return this . userDetailsService ;


signature:
public class AuthenticationWebFilter { /** * Sets the strategy used for converting from a { @ link ServerWebExchange } to an { @ link Authentication } used for
 * authenticating with the provided { @ link ReactiveAuthenticationManager } . If the result is empty , then it signals
 * that no authentication attempt should be made . The default converter is
 * { @ link ServerHttpBasicAuthenticationConverter }
 * @ param authenticationConverter the converter to use
 * @ deprecated As of 5.1 in favor of { @ link # setServerAuthenticationConverter ( ServerAuthenticationConverter ) }
 * @ see # setServerAuthenticationConverter ( ServerAuthenticationConverter ) */
@ Deprecated public void setAuthenticationConverter ( Function < ServerWebExchange , Mono < Authentication > > authenticationConverter ) { } }

implementation: Assert . notNull ( authenticationConverter , "authenticationConverter cannot be null" ) ; setServerAuthenticationConverter ( authenticationConverter :: apply ) ;


signature: public class DataSourcePopulator { public void afterPropertiesSet ( ) throws Exception { } }

implementation:
Assert . notNull ( mutableAclService , "mutableAclService required" ) ; Assert . notNull ( template , "dataSource required" ) ; Assert . notNull ( tt , "platformTransactionManager required" ) ; // Set a user account that will initially own all the created data
Authentication authRequest = new UsernamePasswordAuthenticationToken ( "rod" , "koala" , AuthorityUtils . createAuthorityList ( "ROLE_IGNORED" ) ) ; SecurityContextHolder . getContext ( ) . setAuthentication ( authRequest ) ; try { template . execute ( "DROP TABLE CONTACTS" ) ; template . execute ( "DROP TABLE AUTHORITIES" ) ; template . execute ( "DROP TABLE USERS" ) ; template . execute ( "DROP TABLE ACL_ENTRY" ) ; template . execute ( "DROP TABLE ACL_OBJECT_IDENTITY" ) ; template . execute ( "DROP TABLE ACL_CLASS" ) ; template . execute ( "DROP TABLE ACL_SID" ) ; } catch ( Exception e ) { System . out . println ( "Failed to drop tables: " + e . getMessage ( ) ) ; } template . execute ( "CREATE TABLE ACL_SID(" + "ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 100) NOT NULL PRIMARY KEY," + "PRINCIPAL BOOLEAN NOT NULL," + "SID VARCHAR_IGNORECASE(100) NOT NULL," + "CONSTRAINT UNIQUE_UK_1 UNIQUE(SID,PRINCIPAL));" ) ; template . execute ( "CREATE TABLE ACL_CLASS(" + "ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 100) NOT NULL PRIMARY KEY," + "CLASS VARCHAR_IGNORECASE(100) NOT NULL," + "CLASS_ID_TYPE VARCHAR_IGNORECASE(100)," + "CONSTRAINT UNIQUE_UK_2 UNIQUE(CLASS));" ) ; template . execute ( "CREATE TABLE ACL_OBJECT_IDENTITY(" + "ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 100) NOT NULL PRIMARY KEY," + "OBJECT_ID_CLASS BIGINT NOT NULL," + "OBJECT_ID_IDENTITY VARCHAR_IGNORECASE(36) NOT NULL," + "PARENT_OBJECT BIGINT," + "OWNER_SID BIGINT," + "ENTRIES_INHERITING BOOLEAN NOT NULL," + "CONSTRAINT UNIQUE_UK_3 UNIQUE(OBJECT_ID_CLASS,OBJECT_ID_IDENTITY)," + "CONSTRAINT FOREIGN_FK_1 FOREIGN KEY(PARENT_OBJECT)REFERENCES ACL_OBJECT_IDENTITY(ID)," + "CONSTRAINT FOREIGN_FK_2 FOREIGN KEY(OBJECT_ID_CLASS)REFERENCES ACL_CLASS(ID)," + "CONSTRAINT FOREIGN_FK_3 FOREIGN KEY(OWNER_SID)REFERENCES ACL_SID(ID));" ) ; template . execute ( "CREATE TABLE ACL_ENTRY(" + "ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 100) NOT NULL PRIMARY KEY," + "ACL_OBJECT_IDENTITY BIGINT NOT NULL,ACE_ORDER INT NOT NULL,SID BIGINT NOT NULL," + "MASK INTEGER NOT NULL,GRANTING BOOLEAN NOT NULL,AUDIT_SUCCESS BOOLEAN NOT NULL," + "AUDIT_FAILURE BOOLEAN NOT NULL,CONSTRAINT UNIQUE_UK_4 UNIQUE(ACL_OBJECT_IDENTITY,ACE_ORDER)," + "CONSTRAINT FOREIGN_FK_4 FOREIGN KEY(ACL_OBJECT_IDENTITY) REFERENCES ACL_OBJECT_IDENTITY(ID)," + "CONSTRAINT FOREIGN_FK_5 FOREIGN KEY(SID) REFERENCES ACL_SID(ID));" ) ; template . execute ( "CREATE TABLE USERS(USERNAME VARCHAR_IGNORECASE(50) NOT NULL PRIMARY KEY,PASSWORD VARCHAR_IGNORECASE(500) NOT NULL,ENABLED BOOLEAN NOT NULL);" ) ; template . execute ( "CREATE TABLE AUTHORITIES(USERNAME VARCHAR_IGNORECASE(50) NOT NULL,AUTHORITY VARCHAR_IGNORECASE(50) NOT NULL,CONSTRAINT FK_AUTHORITIES_USERS FOREIGN KEY(USERNAME) REFERENCES USERS(USERNAME));" ) ; template . execute ( "CREATE UNIQUE INDEX IX_AUTH_USERNAME ON AUTHORITIES(USERNAME,AUTHORITY);" ) ; template . execute ( "CREATE TABLE CONTACTS(ID BIGINT NOT NULL PRIMARY KEY, CONTACT_NAME VARCHAR_IGNORECASE(50) NOT NULL, EMAIL VARCHAR_IGNORECASE(50) NOT NULL)" ) ; /* * Passwords encoded using MD5 , NOT in Base64 format , with null as salt Encoded
 * password for rod is " koala " Encoded password for dianne is " emu " Encoded
 * password for scott is " wombat " Encoded password for peter is " opal " ( but user
 * is disabled ) Encoded password for bill is " wombat " Encoded password for bob is
 * " wombat " Encoded password for jane is " wombat " */
template . execute ( "INSERT INTO USERS VALUES('rod','$2a$10$75pBjapg4Nl8Pzd.3JRnUe7PDJmk9qBGwNEJDAlA3V.dEJxcDKn5O',TRUE);" ) ; template . execute ( "INSERT INTO USERS VALUES('dianne','$2a$04$bCMEyxrdF/7sgfUiUJ6Ose2vh9DAMaVBldS1Bw2fhi1jgutZrr9zm',TRUE);" ) ; template . execute ( "INSERT INTO USERS VALUES('scott','$2a$06$eChwvzAu3TSexnC3ynw4LOSw1qiEbtNItNeYv5uI40w1i3paoSfLu',TRUE);" ) ; template . execute ( "INSERT INTO USERS VALUES('peter','$2a$04$8.H8bCMROLF4CIgd7IpeQ.tcBXLP5w8iplO0n.kCIkISwrIgX28Ii',FALSE);" ) ; template . execute ( "INSERT INTO USERS VALUES('bill','$2a$04$8.H8bCMROLF4CIgd7IpeQ.3khQlPVNWbp8kzSQqidQHGFurim7P8O',TRUE);" ) ; template . execute ( "INSERT INTO USERS VALUES('bob','$2a$06$zMgxlMf01SfYNcdx7n4NpeFlAGU8apCETz/i2C7VlYWu6IcNyn4Ay',TRUE);" ) ; template . execute ( "INSERT INTO USERS VALUES('jane','$2a$05$ZrdS7yMhCZ1J.AAidXZhCOxdjD8LO/dhlv4FJzkXA6xh9gdEbBT/u',TRUE);" ) ; template . execute ( "INSERT INTO AUTHORITIES VALUES('rod','ROLE_USER');" ) ; template . execute ( "INSERT INTO AUTHORITIES VALUES('rod','ROLE_SUPERVISOR');" ) ; template . execute ( "INSERT INTO AUTHORITIES VALUES('dianne','ROLE_USER');" ) ; template . execute ( "INSERT INTO AUTHORITIES VALUES('scott','ROLE_USER');" ) ; template . execute ( "INSERT INTO AUTHORITIES VALUES('peter','ROLE_USER');" ) ; template . execute ( "INSERT INTO AUTHORITIES VALUES('bill','ROLE_USER');" ) ; template . execute ( "INSERT INTO AUTHORITIES VALUES('bob','ROLE_USER');" ) ; template . execute ( "INSERT INTO AUTHORITIES VALUES('jane','ROLE_USER');" ) ; template . execute ( "INSERT INTO contacts VALUES (1, 'John Smith', 'john@somewhere.com');" ) ; template . execute ( "INSERT INTO contacts VALUES (2, 'Michael Citizen', 'michael@xyz.com');" ) ; template . execute ( "INSERT INTO contacts VALUES (3, 'Joe Bloggs', 'joe@demo.com');" ) ; template . execute ( "INSERT INTO contacts VALUES (4, 'Karen Sutherland', 'karen@sutherland.com');" ) ; template . execute ( "INSERT INTO contacts VALUES (5, 'Mitchell Howard', 'mitchell@abcdef.com');" ) ; template . execute ( "INSERT INTO contacts VALUES (6, 'Rose Costas', 'rose@xyz.com');" ) ; template . execute ( "INSERT INTO contacts VALUES (7, 'Amanda Smith', 'amanda@abcdef.com');" ) ; template . execute ( "INSERT INTO contacts VALUES (8, 'Cindy Smith', 'cindy@smith.com');" ) ; template . execute ( "INSERT INTO contacts VALUES (9, 'Jonathan Citizen', 'jonathan@xyz.com');" ) ; for ( int i = 10 ; i < createEntities ; i ++ ) { String [ ] person = selectPerson ( ) ; template . execute ( "INSERT INTO contacts VALUES (" + i + ", '" + person [ 2 ] + "', '" + person [ 0 ] . toLowerCase ( ) + "@" + person [ 1 ] . toLowerCase ( ) + ".com');" ) ; } // Create acl _ object _ identity rows ( and also acl _ class rows as needed
for ( int i = 1 ; i < createEntities ; i ++ ) { final ObjectIdentity objectIdentity = new ObjectIdentityImpl ( Contact . class , Long . valueOf ( i ) ) ; tt . execute ( new TransactionCallback < Object > ( ) { public Object doInTransaction ( TransactionStatus arg0 ) { mutableAclService . createAcl ( objectIdentity ) ; return null ; } } ) ; } // Now grant some permissions
grantPermissions ( 1 , "rod" , BasePermission . ADMINISTRATION ) ; grantPermissions ( 2 , "rod" , BasePermission . READ ) ; grantPermissions ( 3 , "rod" , BasePermission . READ ) ; grantPermissions ( 3 , "rod" , BasePermission . WRITE ) ; grantPermissions ( 3 , "rod" , BasePermission . DELETE ) ; grantPermissions ( 4 , "rod" , BasePermission . ADMINISTRATION ) ; grantPermissions ( 4 , "dianne" , BasePermission . ADMINISTRATION ) ; grantPermissions ( 4 , "scott" , BasePermission . READ ) ; grantPermissions ( 5 , "dianne" , BasePermission . ADMINISTRATION ) ; grantPermissions ( 5 , "dianne" , BasePermission . READ ) ; grantPermissions ( 6 , "dianne" , BasePermission . READ ) ; grantPermissions ( 6 , "dianne" , BasePermission . WRITE ) ; grantPermissions ( 6 , "dianne" , BasePermission . DELETE ) ; grantPermissions ( 6 , "scott" , BasePermission . READ ) ; grantPermissions ( 7 , "scott" , BasePermission . ADMINISTRATION ) ; grantPermissions ( 8 , "dianne" , BasePermission . ADMINISTRATION ) ; grantPermissions ( 8 , "dianne" , BasePermission . READ ) ; grantPermissions ( 8 , "scott" , BasePermission . READ ) ; grantPermissions ( 9 , "scott" , BasePermission . ADMINISTRATION ) ; grantPermissions ( 9 , "scott" , BasePermission . READ ) ; grantPermissions ( 9 , "scott" , BasePermission . WRITE ) ; grantPermissions ( 9 , "scott" , BasePermission . DELETE ) ; // Now expressly change the owner of the first ten contacts
// We have to do this last , because " rod " owns all of them ( doing it sooner would
// prevent ACL updates )
// Note that ownership has no impact on permissions - they ' re separate ( ownership
// only allows ACl editing )
changeOwner ( 5 , "dianne" ) ; changeOwner ( 6 , "dianne" ) ; changeOwner ( 7 , "scott" ) ; changeOwner ( 8 , "dianne" ) ; changeOwner ( 9 , "scott" ) ; String [ ] users = { "bill" , "bob" , "jane" } ; // don ' t want to mess around with
// consistent sample data
Permission [ ] permissions = { BasePermission . ADMINISTRATION , BasePermission . READ , BasePermission . DELETE } ; for ( int i = 10 ; i < createEntities ; i ++ ) { String user = users [ rnd . nextInt ( users . length ) ] ; Permission permission = permissions [ rnd . nextInt ( permissions . length ) ] ; grantPermissions ( i , user , permission ) ; String user2 = users [ rnd . nextInt ( users . length ) ] ; Permission permission2 = permissions [ rnd . nextInt ( permissions . length ) ] ; grantPermissions ( i , user2 , permission2 ) ; } SecurityContextHolder . clearContext ( ) ;


signature:
public class JeeConfigurer { /** * Specifies roles to use map from the { @ link HttpServletRequest } to the
 * { @ link UserDetails } . If { @ link HttpServletRequest # isUserInRole ( String ) } returns
 * true , the role is added to the { @ link UserDetails } . This method is the equivalent
 * of invoking { @ link # mappableAuthorities ( Set ) } . Multiple invocations of
 * { @ link # mappableAuthorities ( String . . . ) } will override previous invocations .
 * There are no default roles that are mapped .
 * @ param mappableRoles the roles to attempt to map to the { @ link UserDetails } ( i . e .
 * " ROLE _ USER " , " ROLE _ ADMIN " , etc ) .
 * @ return the { @ link JeeConfigurer } for further customizations
 * @ see SimpleMappableAttributesRetriever
 * @ see # mappableRoles ( String . . . ) */
public JeeConfigurer < H > mappableAuthorities ( String ... mappableRoles ) { } }

implementation: this . mappableRoles . clear ( ) ; for ( String role : mappableRoles ) { this . mappableRoles . add ( role ) ; } return this ;


signature:
public class JeeConfigurer { /** * Populates a { @ link PreAuthenticatedAuthenticationProvider } into
 * { @ link HttpSecurity # authenticationProvider ( org . springframework . security . authentication . AuthenticationProvider ) }
 * and a { @ link Http403ForbiddenEntryPoint } into
 * { @ link HttpSecurityBuilder # setSharedObject ( Class , Object ) }
 * @ see org . springframework . security . config . annotation . SecurityConfigurerAdapter # init ( org . springframework . security . config . annotation . SecurityBuilder ) */
@ Override public void init ( H http ) throws Exception { } }

implementation:
PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider ( ) ; authenticationProvider . setPreAuthenticatedUserDetailsService ( getUserDetailsService ( ) ) ; authenticationProvider = postProcess ( authenticationProvider ) ; // @ formatter : off
http . authenticationProvider ( authenticationProvider ) . setSharedObject ( AuthenticationEntryPoint . class , new Http403ForbiddenEntryPoint ( ) ) ; // @ formatter : on


signature:
public class JeeConfigurer { /** * Gets the { @ link J2eePreAuthenticatedProcessingFilter } or creates a default instance
 * using the properties provided .
 * @ param authenticationManager the { @ link AuthenticationManager } to use .
 * @ return the { @ link J2eePreAuthenticatedProcessingFilter } to use . */
private J2eePreAuthenticatedProcessingFilter getFilter ( AuthenticationManager authenticationManager ) { } }

implementation: if ( j2eePreAuthenticatedProcessingFilter == null ) { j2eePreAuthenticatedProcessingFilter = new J2eePreAuthenticatedProcessingFilter ( ) ; j2eePreAuthenticatedProcessingFilter . setAuthenticationManager ( authenticationManager ) ; j2eePreAuthenticatedProcessingFilter . setAuthenticationDetailsSource ( createWebAuthenticationDetailsSource ( ) ) ; j2eePreAuthenticatedProcessingFilter = postProcess ( j2eePreAuthenticatedProcessingFilter ) ; } return j2eePreAuthenticatedProcessingFilter ;


signature:
public class JeeConfigurer { /** * Creates the { @ link J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource } to set
 * on the { @ link J2eePreAuthenticatedProcessingFilter } . It is populated with a
 * { @ link SimpleMappableAttributesRetriever } .
 * @ return the { @ link J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource } to use . */
private J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource createWebAuthenticationDetailsSource ( ) { } }

implementation: J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource detailsSource = new J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource ( ) ; SimpleMappableAttributesRetriever rolesRetriever = new SimpleMappableAttributesRetriever ( ) ; rolesRetriever . setMappableAttributes ( mappableRoles ) ; detailsSource . setMappableRolesRetriever ( rolesRetriever ) ; detailsSource = postProcess ( detailsSource ) ; return detailsSource ;


signature:
public class DelegatingRequestMatcherHeaderWriter { /** * ( non - Javadoc )
 * @ see
 * org . springframework . security . web . headers . HeaderWriter # writeHeaders ( javax . servlet
 * . http . HttpServletRequest , javax . servlet . http . HttpServletResponse ) */
public void writeHeaders ( HttpServletRequest request , HttpServletResponse response ) { } }

implementation: if ( this . requestMatcher . matches ( request ) ) { this . delegateHeaderWriter . writeHeaders ( request , response ) ; }


signature:
public class HeadersConfigurer { /** * Adds a { @ link HeaderWriter } instance
 * @ param headerWriter the { @ link HeaderWriter } instance to add
 * @ return the { @ link HeadersConfigurer } for additional customizations */
public HeadersConfigurer < H > addHeaderWriter ( HeaderWriter headerWriter ) { } }

implementation: Assert . notNull ( headerWriter , "headerWriter cannot be null" ) ; this . headerWriters . add ( headerWriter ) ; return this ;


signature:
public class HeadersConfigurer { /** * Clears all of the default headers from the response . After doing so , one can add
 * headers back . For example , if you only want to use Spring Security ' s cache control
 * you can use the following :
 * < pre >
 * http . headers ( ) . defaultsDisabled ( ) . cacheControl ( ) ;
 * < / pre >
 * @ return the { @ link HeadersConfigurer } for additional customization */
public HeadersConfigurer < H > defaultsDisabled ( ) { } }

implementation: contentTypeOptions . disable ( ) ; xssProtection . disable ( ) ; cacheControl . disable ( ) ; hsts . disable ( ) ; frameOptions . disable ( ) ; return this ;


signature:
public class HeadersConfigurer { /** * Creates the { @ link HeaderWriter }
 * @ return the { @ link HeaderWriter } */
private HeaderWriterFilter createHeaderWriterFilter ( ) { } }

implementation: List < HeaderWriter > writers = getHeaderWriters ( ) ; if ( writers . isEmpty ( ) ) { throw new IllegalStateException ( "Headers security is enabled, but no headers will be added. Either add headers or disable headers security" ) ; } HeaderWriterFilter headersFilter = new HeaderWriterFilter ( writers ) ; headersFilter = postProcess ( headersFilter ) ; return headersFilter ;


signature:
public class HeadersConfigurer { /** * Gets the { @ link HeaderWriter } instances and possibly initializes with the defaults .
 * @ return */
private List < HeaderWriter > getHeaderWriters ( ) { } }

implementation: List < HeaderWriter > writers = new ArrayList < > ( ) ; addIfNotNull ( writers , contentTypeOptions . writer ) ; addIfNotNull ( writers , xssProtection . writer ) ; addIfNotNull ( writers , cacheControl . writer ) ; addIfNotNull ( writers , hsts . writer ) ; addIfNotNull ( writers , frameOptions . writer ) ; addIfNotNull ( writers , hpkp . writer ) ; addIfNotNull ( writers , contentSecurityPolicy . writer ) ; addIfNotNull ( writers , referrerPolicy . writer ) ; addIfNotNull ( writers , featurePolicy . writer ) ; writers . addAll ( headerWriters ) ; return writers ;


signature:
public class FilterComparator { /** * Registers a { @ link Filter } to exist after a particular { @ link Filter } that is
 * already registered .
 * @ param filter the { @ link Filter } to register
 * @ param afterFilter the { @ link Filter } that is already registered and that
 * { @ code filter } should be placed after . */
public void registerAfter ( Class < ? extends Filter > filter , Class < ? extends Filter > afterFilter ) { } }

implementation: Integer position = getOrder ( afterFilter ) ; if ( position == null ) { throw new IllegalArgumentException ( "Cannot register after unregistered Filter " + afterFilter ) ; } put ( filter , position + 1 ) ;


signature:
public class FilterComparator { /** * Registers a { @ link Filter } to exist at a particular { @ link Filter } position
 * @ param filter the { @ link Filter } to register
 * @ param atFilter the { @ link Filter } that is already registered and that
 * { @ code filter } should be placed at . */
public void registerAt ( Class < ? extends Filter > filter , Class < ? extends Filter > atFilter ) { } }

implementation: Integer position = getOrder ( atFilter ) ; if ( position == null ) { throw new IllegalArgumentException ( "Cannot register after unregistered Filter " + atFilter ) ; } put ( filter , position ) ;


signature:
public class FilterComparator { /** * Registers a { @ link Filter } to exist before a particular { @ link Filter } that is
 * already registered .
 * @ param filter the { @ link Filter } to register
 * @ param beforeFilter the { @ link Filter } that is already registered and that
 * { @ code filter } should be placed before . */
public void registerBefore ( Class < ? extends Filter > filter , Class < ? extends Filter > beforeFilter ) { } }

implementation: Integer position = getOrder ( beforeFilter ) ; if ( position == null ) { throw new IllegalArgumentException ( "Cannot register after unregistered Filter " + beforeFilter ) ; } put ( filter , position - 1 ) ;


signature:
public class FilterComparator { /** * Gets the order of a particular { @ link Filter } class taking into consideration
 * superclasses .
 * @ param clazz the { @ link Filter } class to determine the sort order
 * @ return the sort order or null if not defined */
private Integer getOrder ( Class < ? > clazz ) { } }

implementation: while ( clazz != null ) { Integer result = filterToOrder . get ( clazz . getName ( ) ) ; if ( result != null ) { return result ; } clazz = clazz . getSuperclass ( ) ; } return null ;


signature:
public class JwtGrantedAuthoritiesConverter { /** * Extracts the authorities
 * @ param jwt The { @ link Jwt } token
 * @ return The { @ link GrantedAuthority authorities } read from the token scopes */
@ Override public Collection < GrantedAuthority > convert ( Jwt jwt ) { } }

implementation: return getScopes ( jwt ) . stream ( ) . map ( authority -> SCOPE_AUTHORITY_PREFIX + authority ) . map ( SimpleGrantedAuthority :: new ) . collect ( Collectors . toList ( ) ) ;


signature:
public class JwtGrantedAuthoritiesConverter { /** * Gets the scopes from a { @ link Jwt } token
 * @ param jwt The { @ link Jwt } token
 * @ return The scopes from the token */
private Collection < String > getScopes ( Jwt jwt ) { } }

implementation: for ( String attributeName : WELL_KNOWN_SCOPE_ATTRIBUTE_NAMES ) { Object scopes = jwt . getClaims ( ) . get ( attributeName ) ; if ( scopes instanceof String ) { if ( StringUtils . hasText ( ( String ) scopes ) ) { return Arrays . asList ( ( ( String ) scopes ) . split ( " " ) ) ; } else { return Collections . emptyList ( ) ; } } else if ( scopes instanceof Collection ) { return ( Collection < String > ) scopes ; } } return Collections . emptyList ( ) ;


signature:
public class AuthenticationManagerBuilder { /** * Allows providing a parent { @ link AuthenticationManager } that will be tried if this
 * { @ link AuthenticationManager } was unable to attempt to authenticate the provided
 * { @ link Authentication } .
 * @ param authenticationManager the { @ link AuthenticationManager } that should be used
 * if the current { @ link AuthenticationManager } was unable to attempt to authenticate
 * the provided { @ link Authentication } .
 * @ return the { @ link AuthenticationManagerBuilder } for further adding types of
 * authentication */
public AuthenticationManagerBuilder parentAuthenticationManager ( AuthenticationManager authenticationManager ) { } }

implementation: if ( authenticationManager instanceof ProviderManager ) { eraseCredentials ( ( ( ProviderManager ) authenticationManager ) . isEraseCredentialsAfterAuthentication ( ) ) ; } this . parentAuthenticationManager = authenticationManager ; return this ;


signature:
public class AuthenticationManagerBuilder { /** * Add authentication based upon the custom { @ link UserDetailsService } that is passed
 * in . It then returns a { @ link DaoAuthenticationConfigurer } to allow customization of
 * the authentication .
 * This method also ensure that the { @ link UserDetailsService } is available for the
 * { @ link # getDefaultUserDetailsService ( ) } method . Note that additional
 * { @ link UserDetailsService } ' s may override this { @ link UserDetailsService } as the
 * default .
 * @ return a { @ link DaoAuthenticationConfigurer } to allow customization of the DAO
 * authentication
 * @ throws Exception if an error occurs when adding the { @ link UserDetailsService }
 * based authentication */
public < T extends UserDetailsService > DaoAuthenticationConfigurer < AuthenticationManagerBuilder , T > userDetailsService ( T userDetailsService ) throws Exception { } }

implementation: this . defaultUserDetailsService = userDetailsService ; return apply ( new DaoAuthenticationConfigurer < > ( userDetailsService ) ) ;


signature:
public class AuthenticationManagerBuilder { /** * Captures the { @ link UserDetailsService } from any { @ link UserDetailsAwareConfigurer }
 * @ param configurer the { @ link UserDetailsAwareConfigurer } to capture the
 * { @ link UserDetailsService } from .
 * @ return the { @ link UserDetailsAwareConfigurer } for further customizations
 * @ throws Exception if an error occurs */
private < C extends UserDetailsAwareConfigurer < AuthenticationManagerBuilder , ? extends UserDetailsService > > C apply ( C configurer ) throws Exception { } }

implementation: this . defaultUserDetailsService = configurer . getUserDetailsService ( ) ; return ( C ) super . apply ( configurer ) ;


signature:
public class LazyCsrfTokenRepository { /** * Generates a new token
 * @ param request the { @ link HttpServletRequest } to use . The
 * { @ link HttpServletRequest } must have the { @ link HttpServletResponse } as an
 * attribute with the name of < code > HttpServletResponse . class . getName ( ) < / code > */
@ Override public CsrfToken generateToken ( HttpServletRequest request ) { } }

implementation: return wrap ( request , this . delegate . generateToken ( request ) ) ;


signature:
public class LazyCsrfTokenRepository { /** * Does nothing if the { @ link CsrfToken } is not null . Saving is done only when the
 * { @ link CsrfToken # getToken ( ) } is accessed from
 * { @ link # generateToken ( HttpServletRequest ) } . If it is null , then the save is
 * performed immediately . */
@ Override public void saveToken ( CsrfToken token , HttpServletRequest request , HttpServletResponse response ) { } }

implementation: if ( token == null ) { this . delegate . saveToken ( token , request , response ) ; }


signature:
public class AdminPermissionController { /** * Displays the permission admin page for a particular contact . */
@ RequestMapping ( value = "/secure/adminPermission.htm" , method = RequestMethod . GET ) public ModelAndView displayAdminPage ( @ RequestParam ( "contactId" ) int contactId ) { } }

implementation: Contact contact = contactManager . getById ( Long . valueOf ( contactId ) ) ; Acl acl = aclService . readAclById ( new ObjectIdentityImpl ( contact ) ) ; Map < String , Object > model = new HashMap < > ( ) ; model . put ( "contact" , contact ) ; model . put ( "acl" , acl ) ; return new ModelAndView ( "adminPermission" , "model" , model ) ;


signature:
public class AdminPermissionController { /** * Displays the " add permission " page for a contact . */
@ RequestMapping ( value = "/secure/addPermission.htm" , method = RequestMethod . GET ) public ModelAndView displayAddPermissionPageForContact ( @ RequestParam ( "contactId" ) long contactId ) { } }

implementation: Contact contact = contactManager . getById ( contactId ) ; AddPermission addPermission = new AddPermission ( ) ; addPermission . setContact ( contact ) ; Map < String , Object > model = new HashMap < > ( ) ; model . put ( "addPermission" , addPermission ) ; model . put ( "recipients" , listRecipients ( ) ) ; model . put ( "permissions" , listPermissions ( ) ) ; return new ModelAndView ( "addPermission" , model ) ;


signature:
public class AdminPermissionController { /** * Handles submission of the " add permission " form . */
@ RequestMapping ( value = "/secure/addPermission.htm" , method = RequestMethod . POST ) public String addPermission ( AddPermission addPermission , BindingResult result , ModelMap model ) { } }

implementation: addPermissionValidator . validate ( addPermission , result ) ; if ( result . hasErrors ( ) ) { model . put ( "recipients" , listRecipients ( ) ) ; model . put ( "permissions" , listPermissions ( ) ) ; return "addPermission" ; } PrincipalSid sid = new PrincipalSid ( addPermission . getRecipient ( ) ) ; Permission permission = permissionFactory . buildFromMask ( addPermission . getPermission ( ) ) ; try { contactManager . addPermission ( addPermission . getContact ( ) , sid , permission ) ; } catch ( DataAccessException existingPermission ) { existingPermission . printStackTrace ( ) ; result . rejectValue ( "recipient" , "err.recipientExistsForContact" , "Addition failure." ) ; model . put ( "recipients" , listRecipients ( ) ) ; model . put ( "permissions" , listPermissions ( ) ) ; return "addPermission" ; } return "redirect:/secure/index.htm" ;


signature:
public class AdminPermissionController { /** * Deletes a permission */
@ RequestMapping ( value = "/secure/deletePermission.htm" ) public ModelAndView deletePermission ( @ RequestParam ( "contactId" ) long contactId , @ RequestParam ( "sid" ) String sid , @ RequestParam ( "permission" ) int mask ) { } }

implementation: Contact contact = contactManager . getById ( contactId ) ; Sid sidObject = new PrincipalSid ( sid ) ; Permission permission = permissionFactory . buildFromMask ( mask ) ; contactManager . deletePermission ( contact , sidObject , permission ) ; Map < String , Object > model = new HashMap < > ( ) ; model . put ( "contact" , contact ) ; model . put ( "sid" , sidObject ) ; model . put ( "permission" , permission ) ; return new ModelAndView ( "deletePermission" , "model" , model ) ;


signature:
public class SecurityExpressionRoot { /** * Prefixes role with defaultRolePrefix if defaultRolePrefix is non - null and if role
 * does not already start with defaultRolePrefix .
 * @ param defaultRolePrefix
 * @ param role
 * @ return */
private static String getRoleWithDefaultPrefix ( String defaultRolePrefix , String role ) { } }

implementation: if ( role == null ) { return role ; } if ( defaultRolePrefix == null || defaultRolePrefix . length ( ) == 0 ) { return role ; } if ( role . startsWith ( defaultRolePrefix ) ) { return role ; } return defaultRolePrefix + role ;


signature: public class ChannelProcessingFilter { @ Override public void afterPropertiesSet ( ) { } }

implementation: Assert . notNull ( this . securityMetadataSource , "securityMetadataSource must be specified" ) ; Assert . notNull ( this . channelDecisionManager , "channelDecisionManager must be specified" ) ; Collection < ConfigAttribute > attrDefs = this . securityMetadataSource . getAllConfigAttributes ( ) ; if ( attrDefs == null ) { if ( this . logger . isWarnEnabled ( ) ) { this . logger . warn ( "Could not validate configuration attributes as the FilterInvocationSecurityMetadataSource did " + "not return any attributes" ) ; } return ; } Set < ConfigAttribute > unsupportedAttributes = new HashSet < > ( ) ; for ( ConfigAttribute attr : attrDefs ) { if ( ! this . channelDecisionManager . supports ( attr ) ) { unsupportedAttributes . add ( attr ) ; } } if ( unsupportedAttributes . size ( ) == 0 ) { if ( this . logger . isInfoEnabled ( ) ) { this . logger . info ( "Validated configuration attributes" ) ; } } else { throw new IllegalArgumentException ( "Unsupported configuration attributes: " + unsupportedAttributes ) ; }


signature:
public class OAuth2AuthorizationResponse { /** * Returns a new { @ link Builder } , initialized with the authorization code .
 * @ param code the authorization code
 * @ return the { @ link Builder } */
public static Builder success ( String code ) { } }

implementation: Assert . hasText ( code , "code cannot be empty" ) ; return new Builder ( ) . code ( code ) ;


signature:
public class OAuth2AuthorizationResponse { /** * Returns a new { @ link Builder } , initialized with the error code .
 * @ param errorCode the error code
 * @ return the { @ link Builder } */
public static Builder error ( String errorCode ) { } }

implementation: Assert . hasText ( errorCode , "errorCode cannot be empty" ) ; return new Builder ( ) . errorCode ( errorCode ) ;


signature:
public class NegatedServerWebExchangeMatcher { /** * / * ( non - Javadoc )
 * @ see org . springframework . security . web . server . util . matcher . ServerWebExchangeMatcher # matches ( org . springframework . web . server . ServerWebExchange ) */
@ Override public Mono < MatchResult > matches ( ServerWebExchange exchange ) { } }

implementation: return matcher . matches ( exchange ) . flatMap ( m -> m . isMatch ( ) ? MatchResult . notMatch ( ) : MatchResult . match ( ) ) ;


signature:
public class ReactiveUserDetailsServiceResourceFactoryBean { /** * Create a ReactiveUserDetailsServiceResourceFactoryBean with the location of a Resource that is a Properties file in the
 * format defined in { @ link UserDetailsResourceFactoryBean } .
 * @ param resourceLocation the location of the properties file that contains the users ( i . e . " classpath : users . properties " )
 * @ return the ReactiveUserDetailsServiceResourceFactoryBean */
public static ReactiveUserDetailsServiceResourceFactoryBean fromResourceLocation ( String resourceLocation ) { } }

implementation: ReactiveUserDetailsServiceResourceFactoryBean result = new ReactiveUserDetailsServiceResourceFactoryBean ( ) ; result . setResourceLocation ( resourceLocation ) ; return result ;


signature:
public class ReactiveUserDetailsServiceResourceFactoryBean { /** * Create a ReactiveUserDetailsServiceResourceFactoryBean with a Resource that is a Properties file in the
 * format defined in { @ link UserDetailsResourceFactoryBean } .
 * @ param propertiesResource the Resource that is a properties file that contains the users
 * @ return the ReactiveUserDetailsServiceResourceFactoryBean */
public static ReactiveUserDetailsServiceResourceFactoryBean fromResource ( Resource propertiesResource ) { } }

implementation: ReactiveUserDetailsServiceResourceFactoryBean result = new ReactiveUserDetailsServiceResourceFactoryBean ( ) ; result . setResource ( propertiesResource ) ; return result ;


signature:
public class ReactiveUserDetailsServiceResourceFactoryBean { /** * Create a ReactiveUserDetailsServiceResourceFactoryBean with a String that is in the
 * format defined in { @ link UserDetailsResourceFactoryBean } .
 * @ param users the users in the format defined in { @ link UserDetailsResourceFactoryBean }
 * @ return the ReactiveUserDetailsServiceResourceFactoryBean */
public static ReactiveUserDetailsServiceResourceFactoryBean fromString ( String users ) { } }

implementation: ReactiveUserDetailsServiceResourceFactoryBean result = new ReactiveUserDetailsServiceResourceFactoryBean ( ) ; result . setResource ( new InMemoryResource ( users ) ) ; return result ;


signature:
public class UserDeserializer { /** * This method will create { @ link User } object . It will ensure successful object creation even if password key is null in
 * serialized json , because credentials may be removed from the { @ link User } by invoking { @ link User # eraseCredentials ( ) } .
 * In that case there won ' t be any password key in serialized json .
 * @ param jp the JsonParser
 * @ param ctxt the DeserializationContext
 * @ return the user
 * @ throws IOException if a exception during IO occurs
 * @ throws JsonProcessingException if an error during JSON processing occurs */
@ Override public User deserialize ( JsonParser jp , DeserializationContext ctxt ) throws IOException , JsonProcessingException { } }

implementation: ObjectMapper mapper = ( ObjectMapper ) jp . getCodec ( ) ; JsonNode jsonNode = mapper . readTree ( jp ) ; Set < GrantedAuthority > authorities = mapper . convertValue ( jsonNode . get ( "authorities" ) , new TypeReference < Set < SimpleGrantedAuthority > > ( ) { } ) ; JsonNode password = readJsonNode ( jsonNode , "password" ) ; User result = new User ( readJsonNode ( jsonNode , "username" ) . asText ( ) , password . asText ( "" ) , readJsonNode ( jsonNode , "enabled" ) . asBoolean ( ) , readJsonNode ( jsonNode , "accountNonExpired" ) . asBoolean ( ) , readJsonNode ( jsonNode , "credentialsNonExpired" ) . asBoolean ( ) , readJsonNode ( jsonNode , "accountNonLocked" ) . asBoolean ( ) , authorities ) ; if ( password . asText ( null ) == null ) { result . eraseCredentials ( ) ; } return result ;


signature:
public class AbstractInterceptUrlConfigurer { /** * Creates the default { @ code AccessDecisionManager }
 * @ return the default { @ code AccessDecisionManager } */
private AccessDecisionManager createDefaultAccessDecisionManager ( H http ) { } }

implementation: AffirmativeBased result = new AffirmativeBased ( getDecisionVoters ( http ) ) ; return postProcess ( result ) ;


signature:
public class AbstractInterceptUrlConfigurer { /** * If currently null , creates a default { @ link AccessDecisionManager } using
 * { @ link # createDefaultAccessDecisionManager ( HttpSecurityBuilder ) } . Otherwise returns the
 * { @ link AccessDecisionManager } .
 * @ param http the builder to use
 * @ return the { @ link AccessDecisionManager } to use */
private AccessDecisionManager getAccessDecisionManager ( H http ) { } }

implementation: if ( accessDecisionManager == null ) { accessDecisionManager = createDefaultAccessDecisionManager ( http ) ; } return accessDecisionManager ;


signature:
public class AbstractInterceptUrlConfigurer { /** * Creates the { @ link FilterSecurityInterceptor }
 * @ param http the builder to use
 * @ param metadataSource the { @ link FilterInvocationSecurityMetadataSource } to use
 * @ param authenticationManager the { @ link AuthenticationManager } to use
 * @ return the { @ link FilterSecurityInterceptor }
 * @ throws Exception */
private FilterSecurityInterceptor createFilterSecurityInterceptor ( H http , FilterInvocationSecurityMetadataSource metadataSource , AuthenticationManager authenticationManager ) throws Exception { } }

implementation: FilterSecurityInterceptor securityInterceptor = new FilterSecurityInterceptor ( ) ; securityInterceptor . setSecurityMetadataSource ( metadataSource ) ; securityInterceptor . setAccessDecisionManager ( getAccessDecisionManager ( http ) ) ; securityInterceptor . setAuthenticationManager ( authenticationManager ) ; securityInterceptor . afterPropertiesSet ( ) ; return securityInterceptor ;


signature:
public class UserDetailsResourceFactoryBean { /** * Create a UserDetailsResourceFactoryBean with the location of a Resource that is a Properties file in the
 * format defined in { @ link UserDetailsResourceFactoryBean } .
 * @ param resourceLocation the location of the properties file that contains the users ( i . e . " classpath : users . properties " )
 * @ return the UserDetailsResourceFactoryBean */
public static UserDetailsResourceFactoryBean fromResourceLocation ( String resourceLocation ) { } }

implementation: UserDetailsResourceFactoryBean result = new UserDetailsResourceFactoryBean ( ) ; result . setResourceLocation ( resourceLocation ) ; return result ;


signature:
public class UserDetailsResourceFactoryBean { /** * Create a UserDetailsResourceFactoryBean with a Resource that is a Properties file in the
 * format defined in { @ link UserDetailsResourceFactoryBean } .
 * @ param propertiesResource the Resource that is a properties file that contains the users
 * @ return the UserDetailsResourceFactoryBean */
public static UserDetailsResourceFactoryBean fromResource ( Resource propertiesResource ) { } }

implementation: UserDetailsResourceFactoryBean result = new UserDetailsResourceFactoryBean ( ) ; result . setResource ( propertiesResource ) ; return result ;


signature:
public class UserDetailsResourceFactoryBean { /** * Creates a UserDetailsResourceFactoryBean with a resource from the provided String
 * @ param users the string representing the users
 * @ return the UserDetailsResourceFactoryBean */
public static UserDetailsResourceFactoryBean fromString ( String users ) { } }

implementation: InMemoryResource resource = new InMemoryResource ( users ) ; return fromResource ( resource ) ;


signature:
public class SimpDestinationMessageMatcher { /** * Creates a new instance with the specified pattern ,
 * { @ code SimpMessageType . SUBSCRIBE } , and { @ link PathMatcher } .
 * @ param pattern the pattern to use
 * @ param matcher the { @ link PathMatcher } to use . */
public static SimpDestinationMessageMatcher createSubscribeMatcher ( String pattern , PathMatcher matcher ) { } }

implementation: return new SimpDestinationMessageMatcher ( pattern , SimpMessageType . SUBSCRIBE , matcher ) ;


signature:
public class SimpDestinationMessageMatcher { /** * Creates a new instance with the specified pattern , { @ code SimpMessageType . MESSAGE } ,
 * and { @ link PathMatcher } .
 * @ param pattern the pattern to use
 * @ param matcher the { @ link PathMatcher } to use . */
public static SimpDestinationMessageMatcher createMessageMatcher ( String pattern , PathMatcher matcher ) { } }

implementation: return new SimpDestinationMessageMatcher ( pattern , SimpMessageType . MESSAGE , matcher ) ;


signature:
public class LdapAuthority { /** * Returns the values for a specific attribute
 * @ param name the attribute name
 * @ return a String array , never null but may be zero length */
public List < String > getAttributeValues ( String name ) { } }

implementation: List < String > result = null ; if ( attributes != null ) { result = attributes . get ( name ) ; } if ( result == null ) { result = Collections . emptyList ( ) ; } return result ;


signature:
public class LdapAuthority { /** * Returns the first attribute value for a specified attribute
 * @ param name
 * @ return the first attribute value for a specified attribute , may be null */
public String getFirstAttributeValue ( String name ) { } }

implementation: List < String > result = getAttributeValues ( name ) ; if ( result . isEmpty ( ) ) { return null ; } else { return result . get ( 0 ) ; }


signature:
public class JaasNameCallbackHandler { /** * If the callback passed to the ' handle ' method is an instance of NameCallback , the
 * JaasNameCallbackHandler will call ,
 * callback . setName ( authentication . getPrincipal ( ) . toString ( ) ) .
 * @ param callback
 * @ param authentication
 * @ throws IOException
 * @ throws UnsupportedCallbackException */
public void handle ( Callback callback , Authentication authentication ) throws IOException , UnsupportedCallbackException { } }

implementation: if ( callback instanceof NameCallback ) { NameCallback ncb = ( NameCallback ) callback ; String username ; Object principal = authentication . getPrincipal ( ) ; if ( principal instanceof UserDetails ) { username = ( ( UserDetails ) principal ) . getUsername ( ) ; } else { username = principal . toString ( ) ; } ncb . setName ( username ) ; }


signature:
public class Utf8 { /** * Get the bytes of the String in UTF - 8 encoded form . */
public static byte [ ] encode ( CharSequence string ) { } }

implementation: try { ByteBuffer bytes = CHARSET . newEncoder ( ) . encode ( CharBuffer . wrap ( string ) ) ; byte [ ] bytesCopy = new byte [ bytes . limit ( ) ] ; System . arraycopy ( bytes . array ( ) , 0 , bytesCopy , 0 , bytes . limit ( ) ) ; return bytesCopy ; } catch ( CharacterCodingException e ) { throw new IllegalArgumentException ( "Encoding failed" , e ) ; }


signature:
public class Utf8 { /** * Decode the bytes in UTF - 8 form into a String . */
public static String decode ( byte [ ] bytes ) { } }

implementation: try { return CHARSET . newDecoder ( ) . decode ( ByteBuffer . wrap ( bytes ) ) . toString ( ) ; } catch ( CharacterCodingException e ) { throw new IllegalArgumentException ( "Decoding failed" , e ) ; }


signature: public class SpringCacheBasedTicketCache { public CasAuthenticationToken getByTicketId ( final String serviceTicket ) { } }

implementation: final Cache . ValueWrapper element = serviceTicket != null ? cache . get ( serviceTicket ) : null ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Cache hit: " + ( element != null ) + "; service ticket: " + serviceTicket ) ; } return element == null ? null : ( CasAuthenticationToken ) element . get ( ) ;


signature:
public class AnnotationParameterNameDiscoverer { /** * ( non - Javadoc )
 * @ see org . springframework . core . ParameterNameDiscoverer # getParameterNames ( java
 * . lang . reflect . Method ) */
public String [ ] getParameterNames ( Method method ) { } }

implementation: Method originalMethod = BridgeMethodResolver . findBridgedMethod ( method ) ; String [ ] paramNames = lookupParameterNames ( METHOD_METHODPARAM_FACTORY , originalMethod ) ; if ( paramNames != null ) { return paramNames ; } Class < ? > declaringClass = method . getDeclaringClass ( ) ; Class < ? > [ ] interfaces = declaringClass . getInterfaces ( ) ; for ( Class < ? > intrfc : interfaces ) { Method intrfcMethod = ReflectionUtils . findMethod ( intrfc , method . getName ( ) , method . getParameterTypes ( ) ) ; if ( intrfcMethod != null ) { return lookupParameterNames ( METHOD_METHODPARAM_FACTORY , intrfcMethod ) ; } } return paramNames ;


signature:
public class AnnotationParameterNameDiscoverer { /** * Gets the parameter names or null if not found .
 * @ param parameterNameFactory the { @ link ParameterNameFactory } to use
 * @ param t the { @ link AccessibleObject } to find the parameter names on ( i . e . Method
 * or Constructor )
 * @ return the parameter names or null */
private < T extends AccessibleObject > String [ ] lookupParameterNames ( ParameterNameFactory < T > parameterNameFactory , T t ) { } }

implementation: Annotation [ ] [ ] parameterAnnotations = parameterNameFactory . findParameterAnnotations ( t ) ; int parameterCount = parameterAnnotations . length ; String [ ] paramNames = new String [ parameterCount ] ; boolean found = false ; for ( int i = 0 ; i < parameterCount ; i ++ ) { Annotation [ ] annotations = parameterAnnotations [ i ] ; String parameterName = findParameterName ( annotations ) ; if ( parameterName != null ) { found = true ; paramNames [ i ] = parameterName ; } } return found ? paramNames : null ;


signature:
public class AnnotationParameterNameDiscoverer { /** * Finds the parameter name from the provided { @ link Annotation } s or null if it could
 * not find it . The search is done by looking at the value property of the
 * { @ link # annotationClassesToUse } .
 * @ param parameterAnnotations the { @ link Annotation } ' s to search .
 * @ return */
private String findParameterName ( Annotation [ ] parameterAnnotations ) { } }

implementation: for ( Annotation paramAnnotation : parameterAnnotations ) { if ( annotationClassesToUse . contains ( paramAnnotation . annotationType ( ) . getName ( ) ) ) { return ( String ) AnnotationUtils . getValue ( paramAnnotation , "value" ) ; } } return null ;


signature:
public class AddDeleteContactController { /** * Handles the submission of the contact form , creating a new instance if the username
 * and email are valid . */
@ RequestMapping ( value = "/secure/add.htm" , method = RequestMethod . POST ) public String addContact ( WebContact form , BindingResult result ) { } }

implementation: validator . validate ( form , result ) ; if ( result . hasErrors ( ) ) { return "add" ; } Contact contact = new Contact ( form . getName ( ) , form . getEmail ( ) ) ; contactManager . create ( contact ) ; return "redirect:/secure/index.htm" ;


signature:
public class HpkpHeaderWriter { /** * ( non - Javadoc )
 * @ see org . springframework . security . web . headers . HeaderWriter # writeHeaders ( javax
 * . servlet . http . HttpServletRequest , javax . servlet . http . HttpServletResponse ) */
public void writeHeaders ( HttpServletRequest request , HttpServletResponse response ) { } }

implementation: if ( requestMatcher . matches ( request ) ) { if ( ! pins . isEmpty ( ) ) { String headerName = reportOnly ? HPKP_RO_HEADER_NAME : HPKP_HEADER_NAME ; if ( ! response . containsHeader ( headerName ) ) { response . setHeader ( headerName , hpkpHeaderValue ) ; } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Not injecting HPKP header since there aren't any pins" ) ; } } else if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Not injecting HPKP header since it wasn't a secure connection" ) ; }


signature:
public class HpkpHeaderWriter { /** * Sets the value for the pin - directive of the Public - Key - Pins header .
 * The pin directive specifies a way for web host operators to indicate
 * a cryptographic identity that should be bound to a given web host .
 * See < a href = " https : / / tools . ietf . org / html / rfc7469 # section - 2.1.1 " > Section 2.1.1 < / a > for additional details .
 * To get a pin of
 * Public - Key - Pins :
 * pin - sha256 = " d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM = " ;
 * pin - sha256 = " E9CZ9INDbd + 2eRQozYqqbQ2yXLVKB9 + xcprMF + 44U1g = "
 * Use
 * < code >
 * Map & lt ; String , String & gt ; pins = new HashMap & lt ; String , String & gt ; ( ) ;
 * pins . put ( " d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM = " , " sha256 " ) ;
 * pins . put ( " E9CZ9INDbd + 2eRQozYqqbQ2yXLVKB9 + xcprMF + 44U1g = " , " sha256 " ) ;
 * < / code >
 * @ param pins the map of base64 - encoded SPKI fingerprint & amp ; cryptographic hash algorithm pairs .
 * @ throws IllegalArgumentException if pins is null */
public void setPins ( Map < String , String > pins ) { } }

implementation: Assert . notNull ( pins , "pins cannot be null" ) ; this . pins = pins ; updateHpkpHeaderValue ( ) ;


signature:
public class HpkpHeaderWriter { /** * Adds a list of SHA256 hashed pins for the pin - directive of the Public - Key - Pins header .
 * The pin directive specifies a way for web host operators to indicate
 * a cryptographic identity that should be bound to a given web host .
 * See < a href = " https : / / tools . ietf . org / html / rfc7469 # section - 2.1.1 " > Section 2.1.1 < / a > for additional details .
 * To get a pin of
 * Public - Key - Pins - Report - Only :
 * pin - sha256 = " d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM = " ;
 * pin - sha256 = " E9CZ9INDbd + 2eRQozYqqbQ2yXLVKB9 + xcprMF + 44U1g = "
 * Use
 * HpkpHeaderWriter hpkpHeaderWriter = new HpkpHeaderWriter ( ) ;
 * hpkpHeaderWriter . addSha256Pins ( " d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM " , " E9CZ9INDbd + 2eRQozYqqbQ2yXLVKB9 + xcprMF + 44U1g = " ) ;
 * @ param pins a list of base64 - encoded SPKI fingerprints .
 * @ throws IllegalArgumentException if a pin is null */
public void addSha256Pins ( String ... pins ) { } }

implementation: for ( String pin : pins ) { Assert . notNull ( pin , "pin cannot be null" ) ; this . pins . put ( pin , "sha256" ) ; } updateHpkpHeaderValue ( ) ;


signature:
public class HpkpHeaderWriter { /** * Sets the URI to which the browser should report pin validation failures .
 * See < a href = " https : / / tools . ietf . org / html / rfc7469 # section - 2.1.4 " > Section 2.1.4 < / a >
 * for additional details .
 * To get a header like
 * Public - Key - Pins - Report - Only : max - age = 5184000;
 * pin - sha256 = " E9CZ9INDbd + 2eRQozYqqbQ2yXLVKB9 + xcprMF + 44U1g = " ;
 * pin - sha256 = " LPJNul + wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ = " ;
 * report - uri = " https : / / other . example . net / pkp - report "
 * Use
 * HpkpHeaderWriter hpkpHeaderWriter = new HpkpHeaderWriter ( ) ;
 * hpkpHeaderWriter . setReportUri ( " https : / / other . example . net / pkp - report " ) ;
 * @ param reportUri the URI where the browser should send the report to .
 * @ throws IllegalArgumentException if the reportUri is not a valid URI */
public void setReportUri ( String reportUri ) { } }

implementation: try { this . reportUri = new URI ( reportUri ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( e ) ; } updateHpkpHeaderValue ( ) ;


signature:
public class MapBasedMethodSecurityMetadataSource { /** * Will walk the method inheritance tree to find the most specific declaration
 * applicable . */
@ Override protected Collection < ConfigAttribute > findAttributes ( Method method , Class < ? > targetClass ) { } }

implementation: if ( targetClass == null ) { return null ; } return findAttributesSpecifiedAgainst ( method , targetClass ) ;


signature:
public class MapBasedMethodSecurityMetadataSource { /** * Add configuration attributes for a secure method . Method names can end or start
 * with < code > * < / code > for matching multiple methods .
 * @ param name type and method name , separated by a dot
 * @ param attr the security attributes associated with the method */
private void addSecureMethod ( String name , List < ConfigAttribute > attr ) { } }

implementation: int lastDotIndex = name . lastIndexOf ( "." ) ; if ( lastDotIndex == - 1 ) { throw new IllegalArgumentException ( "'" + name + "' is not a valid method name: format is FQN.methodName" ) ; } String methodName = name . substring ( lastDotIndex + 1 ) ; Assert . hasText ( methodName , ( ) -> "Method not found for '" + name + "'" ) ; String typeName = name . substring ( 0 , lastDotIndex ) ; Class < ? > type = ClassUtils . resolveClassName ( typeName , this . beanClassLoader ) ; addSecureMethod ( type , methodName , attr ) ;


signature:
public class MapBasedMethodSecurityMetadataSource { /** * Add configuration attributes for a secure method . Mapped method names can end or
 * start with < code > * < / code > for matching multiple methods .
 * @ param javaType target interface or class the security configuration attribute
 * applies to
 * @ param mappedName mapped method name , which the javaType has declared or inherited
 * @ param attr required authorities associated with the method */
public void addSecureMethod ( Class < ? > javaType , String mappedName , List < ConfigAttribute > attr ) { } }

implementation:
String name = javaType . getName ( ) + '.' + mappedName ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Request to add secure method [" + name + "] with attributes [" + attr + "]" ) ; } Method [ ] methods = javaType . getMethods ( ) ; List < Method > matchingMethods = new ArrayList < > ( ) ; for ( Method m : methods ) { if ( m . getName ( ) . equals ( mappedName ) || isMatch ( m . getName ( ) , mappedName ) ) { matchingMethods . add ( m ) ; } } if ( matchingMethods . isEmpty ( ) ) { throw new IllegalArgumentException ( "Couldn't find method '" + mappedName + "' on '" + javaType + "'" ) ; } // register all matching methods
for ( Method method : matchingMethods ) { RegisteredMethod registeredMethod = new RegisteredMethod ( method , javaType ) ; String regMethodName = ( String ) this . nameMap . get ( registeredMethod ) ; if ( ( regMethodName == null ) || ( ! regMethodName . equals ( name ) && ( regMethodName . length ( ) <= name . length ( ) ) ) ) { // no already registered method name , or more specific
// method name specification now - > ( re - ) register method
if ( regMethodName != null ) { logger . debug ( "Replacing attributes for secure method [" + method + "]: current name [" + name + "] is more specific than [" + regMethodName + "]" ) ; } this . nameMap . put ( registeredMethod , name ) ; addSecureMethod ( registeredMethod , attr ) ; } else { logger . debug ( "Keeping attributes for secure method [" + method + "]: current name [" + name + "] is not more specific than [" + regMethodName + "]" ) ; } }


signature:
public class MapBasedMethodSecurityMetadataSource { /** * Adds configuration attributes for a specific method , for example where the method
 * has been matched using a pointcut expression . If a match already exists in the map
 * for the method , then the existing match will be retained , so that if this method is
 * called for a more general pointcut it will not override a more specific one which
 * has already been added .
 * This method should only be called during initialization of the { @ code BeanFactory } . */
public void addSecureMethod ( Class < ? > javaType , Method method , List < ConfigAttribute > attr ) { } }

implementation: RegisteredMethod key = new RegisteredMethod ( method , javaType ) ; if ( methodMap . containsKey ( key ) ) { logger . debug ( "Method [" + method + "] is already registered with attributes [" + methodMap . get ( key ) + "]" ) ; return ; } methodMap . put ( key , attr ) ;


signature:
public class MapBasedMethodSecurityMetadataSource { /** * Add configuration attributes for a secure method .
 * @ param method the method to be secured
 * @ param attr required authorities associated with the method */
private void addSecureMethod ( RegisteredMethod method , List < ConfigAttribute > attr ) { } }

implementation: Assert . notNull ( method , "RegisteredMethod required" ) ; Assert . notNull ( attr , "Configuration attribute required" ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "Adding secure method [" + method + "] with attributes [" + attr + "]" ) ; } this . methodMap . put ( method , attr ) ;


signature:
public class MapBasedMethodSecurityMetadataSource { /** * Obtains the configuration attributes explicitly defined against this bean .
 * @ return the attributes explicitly defined against this bean */
@ Override public Collection < ConfigAttribute > getAllConfigAttributes ( ) { } }

implementation: Set < ConfigAttribute > allAttributes = new HashSet < > ( ) ; for ( List < ConfigAttribute > attributeList : methodMap . values ( ) ) { allAttributes . addAll ( attributeList ) ; } return allAttributes ;


signature:
public class MapBasedMethodSecurityMetadataSource { /** * Return if the given method name matches the mapped name . The default implementation
 * checks for " xxx " and " xxx " matches .
 * @ param methodName the method name of the class
 * @ param mappedName the name in the descriptor
 * @ return if the names match */
private boolean isMatch ( String methodName , String mappedName ) { } }

implementation: return ( mappedName . endsWith ( "*" ) && methodName . startsWith ( mappedName . substring ( 0 , mappedName . length ( ) - 1 ) ) ) || ( mappedName . startsWith ( "*" ) && methodName . endsWith ( mappedName . substring ( 1 , mappedName . length ( ) ) ) ) ;


signature:
public class PortMapperConfigurer { /** * Gets the { @ link PortMapper } to use . If { @ link # portMapper ( PortMapper ) } was not
 * invoked , builds a { @ link PortMapperImpl } using the port mappings specified with
 * { @ link # http ( int ) } .
 * @ return the { @ link PortMapper } to use */
private PortMapper getPortMapper ( ) { } }

implementation: if ( portMapper == null ) { PortMapperImpl portMapper = new PortMapperImpl ( ) ; portMapper . setPortMappings ( httpsPortMappings ) ; this . portMapper = portMapper ; } return portMapper ;


signature:
public class HttpSessionCsrfTokenRepository { /** * ( non - Javadoc )
 * @ see org . springframework . security . web . csrf . CsrfTokenRepository # saveToken ( org .
 * springframework . security . web . csrf . CsrfToken ,
 * javax . servlet . http . HttpServletRequest , javax . servlet . http . HttpServletResponse ) */
public void saveToken ( CsrfToken token , HttpServletRequest request , HttpServletResponse response ) { } }

implementation: if ( token == null ) { HttpSession session = request . getSession ( false ) ; if ( session != null ) { session . removeAttribute ( this . sessionAttributeName ) ; } } else { HttpSession session = request . getSession ( ) ; session . setAttribute ( this . sessionAttributeName , token ) ; }


signature:
public class HttpSessionCsrfTokenRepository { /** * ( non - Javadoc )
 * @ see
 * org . springframework . security . web . csrf . CsrfTokenRepository # loadToken ( javax . servlet
 * . http . HttpServletRequest ) */
public CsrfToken loadToken ( HttpServletRequest request ) { } }

implementation: HttpSession session = request . getSession ( false ) ; if ( session == null ) { return null ; } return ( CsrfToken ) session . getAttribute ( this . sessionAttributeName ) ;


signature:
public class ReactiveJwtDecoders { /** * Creates a { @ link ReactiveJwtDecoder } using the provided
 * < a href = " https : / / openid . net / specs / openid - connect - core - 1_0 . html # IssuerIdentifier " > Issuer < / a > by making an
 * < a href = " https : / / openid . net / specs / openid - connect - discovery - 1_0 . html # ProviderConfigurationRequest " > OpenID Provider
 * Configuration Request < / a > and using the values in the
 * < a href = " https : / / openid . net / specs / openid - connect - discovery - 1_0 . html # ProviderConfigurationResponse " > OpenID
 * Provider Configuration Response < / a > to initialize the { @ link ReactiveJwtDecoder } .
 * @ param oidcIssuerLocation the < a href = " https : / / openid . net / specs / openid - connect - core - 1_0 . html # IssuerIdentifier " > Issuer < / a >
 * @ return a { @ link ReactiveJwtDecoder } that was initialized by the OpenID Provider Configuration . */
public static ReactiveJwtDecoder fromOidcIssuerLocation ( String oidcIssuerLocation ) { } }

implementation: Map < String , Object > openidConfiguration = getOpenidConfiguration ( oidcIssuerLocation ) ; String metadataIssuer = "(unavailable)" ; if ( openidConfiguration . containsKey ( "issuer" ) ) { metadataIssuer = openidConfiguration . get ( "issuer" ) . toString ( ) ; } if ( ! oidcIssuerLocation . equals ( metadataIssuer ) ) { throw new IllegalStateException ( "The Issuer \"" + metadataIssuer + "\" provided in the OpenID Configuration " + "did not match the requested issuer \"" + oidcIssuerLocation + "\"" ) ; } OAuth2TokenValidator < Jwt > jwtValidator = JwtValidators . createDefaultWithIssuer ( oidcIssuerLocation ) ; NimbusReactiveJwtDecoder jwtDecoder = new NimbusReactiveJwtDecoder ( openidConfiguration . get ( "jwks_uri" ) . toString ( ) ) ; jwtDecoder . setJwtValidator ( jwtValidator ) ; return jwtDecoder ;


signature:
public class OrServerWebExchangeMatcher { /** * / * ( non - Javadoc )
 * @ see org . springframework . security . web . server . util . matcher . ServerWebExchangeMatcher # matches ( org . springframework . web . server . ServerWebExchange ) */
@ Override public Mono < MatchResult > matches ( ServerWebExchange exchange ) { } }

implementation: return Flux . fromIterable ( matchers ) . flatMap ( m -> m . matches ( exchange ) ) . filter ( m -> m . isMatch ( ) ) . next ( ) . switchIfEmpty ( MatchResult . notMatch ( ) ) ;


signature:
public class AuthorityReactiveAuthorizationManager { /** * Creates an instance of { @ link AuthorityReactiveAuthorizationManager } with the
 * provided authority .
 * @ param authority the authority to check for
 * @ param < T > the type of object being authorized
 * @ return the new instance */
public static < T > AuthorityReactiveAuthorizationManager < T > hasAuthority ( String authority ) { } }

implementation: Assert . notNull ( authority , "authority cannot be null" ) ; return new AuthorityReactiveAuthorizationManager < > ( authority ) ;


signature:
public class AuthorityReactiveAuthorizationManager { /** * Creates an instance of { @ link AuthorityReactiveAuthorizationManager } with the
 * provided authorities .
 * @ author Robbie Martinus
 * @ param authorities the authorities to check for
 * @ param < T > the type of object being authorized
 * @ return the new instance */
public static < T > AuthorityReactiveAuthorizationManager < T > hasAnyAuthority ( String ... authorities ) { } }

implementation: Assert . notNull ( authorities , "authorities cannot be null" ) ; for ( String authority : authorities ) { Assert . notNull ( authority , "authority cannot be null" ) ; } return new AuthorityReactiveAuthorizationManager < > ( authorities ) ;


signature:
public class AuthorityReactiveAuthorizationManager { /** * Creates an instance of { @ link AuthorityReactiveAuthorizationManager } with the
 * provided authority .
 * @ param role the authority to check for prefixed with " ROLE _ "
 * @ param < T > the type of object being authorized
 * @ return the new instance */
public static < T > AuthorityReactiveAuthorizationManager < T > hasRole ( String role ) { } }

implementation: Assert . notNull ( role , "role cannot be null" ) ; return hasAuthority ( "ROLE_" + role ) ;


signature:
public class AuthorityReactiveAuthorizationManager { /** * Creates an instance of { @ link AuthorityReactiveAuthorizationManager } with the
 * provided authorities .
 * @ author Robbie Martinus
 * @ param roles the authorities to check for prefixed with " ROLE _ "
 * @ param < T > the type of object being authorized
 * @ return the new instance */
public static < T > AuthorityReactiveAuthorizationManager < T > hasAnyRole ( String ... roles ) { } }

implementation: Assert . notNull ( roles , "roles cannot be null" ) ; for ( String role : roles ) { Assert . notNull ( role , "role cannot be null" ) ; } return hasAnyAuthority ( Stream . of ( roles ) . map ( r -> "ROLE_" + r ) . toArray ( String [ ] :: new ) ) ;


signature:
public class HttpSessionSecurityContextRepository { /** * Gets the security context for the current request ( if available ) and returns it .
 * If the session is null , the context object is null or the context object stored in
 * the session is not an instance of { @ code SecurityContext } , a new context object
 * will be generated and returned . */
public SecurityContext loadContext ( HttpRequestResponseHolder requestResponseHolder ) { } }

implementation: HttpServletRequest request = requestResponseHolder . getRequest ( ) ; HttpServletResponse response = requestResponseHolder . getResponse ( ) ; HttpSession httpSession = request . getSession ( false ) ; SecurityContext context = readSecurityContextFromSession ( httpSession ) ; if ( context == null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "No SecurityContext was available from the HttpSession: " + httpSession + ". " + "A new one will be created." ) ; } context = generateNewContext ( ) ; } SaveToSessionResponseWrapper wrappedResponse = new SaveToSessionResponseWrapper ( response , request , httpSession != null , context ) ; requestResponseHolder . setResponse ( wrappedResponse ) ; requestResponseHolder . setRequest ( new SaveToSessionRequestWrapper ( request , wrappedResponse ) ) ; return context ;


signature:
public class AbstractRequestMatcherRegistry { /** * Maps any request .
 * @ return the object that is chained after creating the { @ link RequestMatcher } */
public C anyRequest ( ) { } }

implementation: Assert . state ( ! this . anyRequestConfigured , "Can't configure anyRequest after itself" ) ; C configurer = requestMatchers ( ANY_REQUEST ) ; this . anyRequestConfigured = true ; return configurer ;


signature:
public class AbstractRequestMatcherRegistry { /** * Maps a { @ link List } of
 * { @ link org . springframework . security . web . util . matcher . AntPathRequestMatcher }
 * instances that do not care which { @ link HttpMethod } is used .
 * @ param antPatterns the ant patterns to create
 * { @ link org . springframework . security . web . util . matcher . AntPathRequestMatcher } from
 * @ return the object that is chained after creating the { @ link RequestMatcher } */
public C antMatchers ( String ... antPatterns ) { } }

implementation: Assert . state ( ! this . anyRequestConfigured , "Can't configure antMatchers after anyRequest" ) ; return chainRequestMatchers ( RequestMatchers . antMatchers ( antPatterns ) ) ;


signature:
public class AbstractRequestMatcherRegistry { /** * Creates { @ link MvcRequestMatcher } instances for the method and patterns passed in
 * @ param method the HTTP method to use or null if any should be used
 * @ param mvcPatterns the Spring MVC patterns to match on
 * @ return a List of { @ link MvcRequestMatcher } instances */
protected final List < MvcRequestMatcher > createMvcMatchers ( HttpMethod method , String ... mvcPatterns ) { } }

implementation: Assert . state ( ! this . anyRequestConfigured , "Can't configure mvcMatchers after anyRequest" ) ; ObjectPostProcessor < Object > opp = this . context . getBean ( ObjectPostProcessor . class ) ; if ( ! this . context . containsBean ( HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME ) ) { throw new NoSuchBeanDefinitionException ( "A Bean named " + HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME + " of type " + HandlerMappingIntrospector . class . getName ( ) + " is required to use MvcRequestMatcher. Please ensure Spring Security & Spring MVC are configured in a shared ApplicationContext." ) ; } HandlerMappingIntrospector introspector = this . context . getBean ( HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME , HandlerMappingIntrospector . class ) ; List < MvcRequestMatcher > matchers = new ArrayList < > ( mvcPatterns . length ) ; for ( String mvcPattern : mvcPatterns ) { MvcRequestMatcher matcher = new MvcRequestMatcher ( introspector , mvcPattern ) ; opp . postProcess ( matcher ) ; if ( method != null ) { matcher . setMethod ( method ) ; } matchers . add ( matcher ) ; } return matchers ;


signature:
public class AbstractRequestMatcherRegistry { /** * Maps a { @ link List } of
 * { @ link org . springframework . security . web . util . matcher . RegexRequestMatcher }
 * instances .
 * @ param method the { @ link HttpMethod } to use or { @ code null } for any
 * { @ link HttpMethod } .
 * @ param regexPatterns the regular expressions to create
 * { @ link org . springframework . security . web . util . matcher . RegexRequestMatcher } from
 * @ return the object that is chained after creating the { @ link RequestMatcher } */
public C regexMatchers ( HttpMethod method , String ... regexPatterns ) { } }

implementation: Assert . state ( ! this . anyRequestConfigured , "Can't configure regexMatchers after anyRequest" ) ; return chainRequestMatchers ( RequestMatchers . regexMatchers ( method , regexPatterns ) ) ;


signature:
public class AbstractRequestMatcherRegistry { /** * Associates a list of { @ link RequestMatcher } instances with the
 * { @ link AbstractConfigAttributeRequestMatcherRegistry }
 * @ param requestMatchers the { @ link RequestMatcher } instances
 * @ return the object that is chained after creating the { @ link RequestMatcher } */
public C requestMatchers ( RequestMatcher ... requestMatchers ) { } }

implementation: Assert . state ( ! this . anyRequestConfigured , "Can't configure requestMatchers after anyRequest" ) ; return chainRequestMatchers ( Arrays . asList ( requestMatchers ) ) ;


signature:
public class AuthenticationPrincipalArgumentResolver { /** * ( non - Javadoc )
 * @ see
 * org . springframework . messaging . handler . invocation . HandlerMethodArgumentResolver #
 * resolveArgument ( org . springframework . core . MethodParameter ,
 * org . springframework . messaging . Message ) */
public Object resolveArgument ( MethodParameter parameter , Message < ? > message ) throws Exception { } }

implementation: Authentication authentication = SecurityContextHolder . getContext ( ) . getAuthentication ( ) ; if ( authentication == null ) { return null ; } Object principal = authentication . getPrincipal ( ) ; AuthenticationPrincipal authPrincipal = findMethodAnnotation ( AuthenticationPrincipal . class , parameter ) ; String expressionToParse = authPrincipal . expression ( ) ; if ( StringUtils . hasLength ( expressionToParse ) ) { StandardEvaluationContext context = new StandardEvaluationContext ( ) ; context . setRootObject ( principal ) ; context . setVariable ( "this" , principal ) ; Expression expression = this . parser . parseExpression ( expressionToParse ) ; principal = expression . getValue ( context ) ; } if ( principal != null && ! parameter . getParameterType ( ) . isAssignableFrom ( principal . getClass ( ) ) ) { if ( authPrincipal . errorOnInvalidType ( ) ) { throw new ClassCastException ( principal + " is not assignable to " + parameter . getParameterType ( ) ) ; } else { return null ; } } return principal ;


signature:
public class DefaultJaasAuthenticationProvider { /** * Creates a LoginContext using the Configuration that was specified in
 * { @ link # setConfiguration ( Configuration ) } . */
@ Override protected LoginContext createLoginContext ( CallbackHandler handler ) throws LoginException { } }

implementation: return new LoginContext ( getLoginContextName ( ) , null , handler , getConfiguration ( ) ) ;


signature: public class BindAuthenticator { public DirContextOperations authenticate ( Authentication authentication ) { } }

implementation:
DirContextOperations user = null ; Assert . isInstanceOf ( UsernamePasswordAuthenticationToken . class , authentication , "Can only process UsernamePasswordAuthenticationToken objects" ) ; String username = authentication . getName ( ) ; String password = ( String ) authentication . getCredentials ( ) ; if ( ! StringUtils . hasLength ( password ) ) { logger . debug ( "Rejecting empty password for user " + username ) ; throw new BadCredentialsException ( messages . getMessage ( "BindAuthenticator.emptyPassword" , "Empty Password" ) ) ; } // If DN patterns are configured , try authenticating with them directly
for ( String dn : getUserDns ( username ) ) { user = bindWithDn ( dn , username , password ) ; if ( user != null ) { break ; } } // Otherwise use the configured search object to find the user and authenticate
// with the returned DN .
if ( user == null && getUserSearch ( ) != null ) { DirContextOperations userFromSearch = getUserSearch ( ) . searchForUser ( username ) ; user = bindWithDn ( userFromSearch . getDn ( ) . toString ( ) , username , password , userFromSearch . getAttributes ( ) ) ; } if ( user == null ) { throw new BadCredentialsException ( messages . getMessage ( "BindAuthenticator.badCredentials" , "Bad credentials" ) ) ; } return user ;


signature:
public class BindAuthenticator { /** * Allows subclasses to inspect the exception thrown by an attempt to bind with a
 * particular DN . The default implementation just reports the failure to the debug
 * logger . */
protected void handleBindException ( String userDn , String username , Throwable cause ) { } }

implementation: if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Failed to bind as " + userDn + ": " + cause ) ; }


signature:
public class OAuth2UserRequestEntityConverter { /** * Returns the { @ link RequestEntity } used for the UserInfo Request .
 * @ param userRequest the user request
 * @ return the { @ link RequestEntity } used for the UserInfo Request */
@ Override public RequestEntity < ? > convert ( OAuth2UserRequest userRequest ) { } }

implementation: ClientRegistration clientRegistration = userRequest . getClientRegistration ( ) ; HttpMethod httpMethod = HttpMethod . GET ; if ( AuthenticationMethod . FORM . equals ( clientRegistration . getProviderDetails ( ) . getUserInfoEndpoint ( ) . getAuthenticationMethod ( ) ) ) { httpMethod = HttpMethod . POST ; } HttpHeaders headers = new HttpHeaders ( ) ; headers . setAccept ( Collections . singletonList ( MediaType . APPLICATION_JSON ) ) ; URI uri = UriComponentsBuilder . fromUriString ( clientRegistration . getProviderDetails ( ) . getUserInfoEndpoint ( ) . getUri ( ) ) . build ( ) . toUri ( ) ; RequestEntity < ? > request ; if ( HttpMethod . POST . equals ( httpMethod ) ) { headers . setContentType ( DEFAULT_CONTENT_TYPE ) ; MultiValueMap < String , String > formParameters = new LinkedMultiValueMap < > ( ) ; formParameters . add ( OAuth2ParameterNames . ACCESS_TOKEN , userRequest . getAccessToken ( ) . getTokenValue ( ) ) ; request = new RequestEntity < > ( formParameters , headers , httpMethod , uri ) ; } else { headers . setBearerAuth ( userRequest . getAccessToken ( ) . getTokenValue ( ) ) ; request = new RequestEntity < > ( headers , httpMethod , uri ) ; } return request ;


signature:
public class CsrfFilter { /** * ( non - Javadoc )
 * @ see
 * org . springframework . web . filter . OncePerRequestFilter # doFilterInternal ( javax . servlet
 * . http . HttpServletRequest , javax . servlet . http . HttpServletResponse ,
 * javax . servlet . FilterChain ) */
@ Override protected void doFilterInternal ( HttpServletRequest request , HttpServletResponse response , FilterChain filterChain ) throws ServletException , IOException { } }

implementation: request . setAttribute ( HttpServletResponse . class . getName ( ) , response ) ; CsrfToken csrfToken = this . tokenRepository . loadToken ( request ) ; final boolean missingToken = csrfToken == null ; if ( missingToken ) { csrfToken = this . tokenRepository . generateToken ( request ) ; this . tokenRepository . saveToken ( csrfToken , request , response ) ; } request . setAttribute ( CsrfToken . class . getName ( ) , csrfToken ) ; request . setAttribute ( csrfToken . getParameterName ( ) , csrfToken ) ; if ( ! this . requireCsrfProtectionMatcher . matches ( request ) ) { filterChain . doFilter ( request , response ) ; return ; } String actualToken = request . getHeader ( csrfToken . getHeaderName ( ) ) ; if ( actualToken == null ) { actualToken = request . getParameter ( csrfToken . getParameterName ( ) ) ; } if ( ! csrfToken . getToken ( ) . equals ( actualToken ) ) { if ( this . logger . isDebugEnabled ( ) ) { this . logger . debug ( "Invalid CSRF token found for " + UrlUtils . buildFullRequestUrl ( request ) ) ; } if ( missingToken ) { this . accessDeniedHandler . handle ( request , response , new MissingCsrfTokenException ( actualToken ) ) ; } else { this . accessDeniedHandler . handle ( request , response , new InvalidCsrfTokenException ( csrfToken , actualToken ) ) ; } return ; } filterChain . doFilter ( request , response ) ;


signature:
public class CompositeSessionAuthenticationStrategy { /** * ( non - Javadoc )
 * @ see org . springframework . security . web . authentication . session .
 * SessionAuthenticationStrategy
 * # onAuthentication ( org . springframework . security . core . Authentication ,
 * javax . servlet . http . HttpServletRequest , javax . servlet . http . HttpServletResponse ) */
public void onAuthentication ( Authentication authentication , HttpServletRequest request , HttpServletResponse response ) throws SessionAuthenticationException { } }

implementation: for ( SessionAuthenticationStrategy delegate : this . delegateStrategies ) { if ( this . logger . isDebugEnabled ( ) ) { this . logger . debug ( "Delegating to " + delegate ) ; } delegate . onAuthentication ( authentication , request , response ) ; }


signature:
public class AbstractLdapAuthenticator { /** * Builds list of possible DNs for the user , worked out from the
 * < tt > userDnPatterns < / tt > property .
 * @ param username the user ' s login name
 * @ return the list of possible DN matches , empty if < tt > userDnPatterns < / tt > wasn ' t
 * set . */
protected List < String > getUserDns ( String username ) { } }

implementation: if ( userDnFormat == null ) { return Collections . emptyList ( ) ; } List < String > userDns = new ArrayList < > ( userDnFormat . length ) ; String [ ] args = new String [ ] { LdapEncoder . nameEncode ( username ) } ; synchronized ( userDnFormat ) { for ( MessageFormat formatter : userDnFormat ) { userDns . add ( formatter . format ( args ) ) ; } } return userDns ;


signature:
public class AbstractLdapAuthenticator { /** * Sets the pattern which will be used to supply a DN for the user . The pattern should
 * be the name relative to the root DN . The pattern argument { 0 } will contain the
 * username . An example would be " cn = { 0 } , ou = people " .
 * @ param dnPattern the array of patterns which will be tried when converting a
 * username to a DN . */
public void setUserDnPatterns ( String [ ] dnPattern ) { } }

implementation:
Assert . notNull ( dnPattern , "The array of DN patterns cannot be set to null" ) ; // this . userDnPattern = dnPattern ;
userDnFormat = new MessageFormat [ dnPattern . length ] ; for ( int i = 0 ; i < dnPattern . length ; i ++ ) { userDnFormat [ i ] = new MessageFormat ( dnPattern [ i ] ) ; }


signature: public class LoggerListener { public void onApplicationEvent ( AbstractAuthorizationEvent event ) { } }

implementation: if ( event instanceof AuthenticationCredentialsNotFoundEvent ) { AuthenticationCredentialsNotFoundEvent authEvent = ( AuthenticationCredentialsNotFoundEvent ) event ; if ( logger . isWarnEnabled ( ) ) { logger . warn ( "Security interception failed due to: " + authEvent . getCredentialsNotFoundException ( ) + "; secure object: " + authEvent . getSource ( ) + "; configuration attributes: " + authEvent . getConfigAttributes ( ) ) ; } } if ( event instanceof AuthorizationFailureEvent ) { AuthorizationFailureEvent authEvent = ( AuthorizationFailureEvent ) event ; if ( logger . isWarnEnabled ( ) ) { logger . warn ( "Security authorization failed due to: " + authEvent . getAccessDeniedException ( ) + "; authenticated principal: " + authEvent . getAuthentication ( ) + "; secure object: " + authEvent . getSource ( ) + "; configuration attributes: " + authEvent . getConfigAttributes ( ) ) ; } } if ( event instanceof AuthorizedEvent ) { AuthorizedEvent authEvent = ( AuthorizedEvent ) event ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "Security authorized for authenticated principal: " + authEvent . getAuthentication ( ) + "; secure object: " + authEvent . getSource ( ) + "; configuration attributes: " + authEvent . getConfigAttributes ( ) ) ; } } if ( event instanceof PublicInvocationEvent ) { PublicInvocationEvent authEvent = ( PublicInvocationEvent ) event ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "Security interception not required for public secure object: " + authEvent . getSource ( ) ) ; } }


signature:
public class AbstractConfigAttributeRequestMatcherRegistry { /** * Creates the mapping of { @ link RequestMatcher } to { @ link Collection } of
 * { @ link ConfigAttribute } instances
 * @ return the mapping of { @ link RequestMatcher } to { @ link Collection } of
 * { @ link ConfigAttribute } instances . Cannot be null . */
final LinkedHashMap < RequestMatcher , Collection < ConfigAttribute > > createRequestMap ( ) { } }

implementation: if ( unmappedMatchers != null ) { throw new IllegalStateException ( "An incomplete mapping was found for " + unmappedMatchers + ". Try completing it with something like requestUrls().<something>.hasRole('USER')" ) ; } LinkedHashMap < RequestMatcher , Collection < ConfigAttribute > > requestMap = new LinkedHashMap < RequestMatcher , Collection < ConfigAttribute > > ( ) ; for ( UrlMapping mapping : getUrlMappings ( ) ) { RequestMatcher matcher = mapping . getRequestMatcher ( ) ; Collection < ConfigAttribute > configAttrs = mapping . getConfigAttrs ( ) ; requestMap . put ( matcher , configAttrs ) ; } return requestMap ;


signature:
public class HttpStatusReturningLogoutSuccessHandler { /** * Implementation of
 * { @ link LogoutSuccessHandler # onLogoutSuccess ( HttpServletRequest , HttpServletResponse , Authentication ) }
 * . Sets the status on the { @ link HttpServletResponse } . */
public void onLogoutSuccess ( HttpServletRequest request , HttpServletResponse response , Authentication authentication ) throws IOException , ServletException { } }

implementation: response . setStatus ( this . httpStatusToReturn . value ( ) ) ; response . getWriter ( ) . flush ( ) ;


signature:
public class DefaultWebInvocationPrivilegeEvaluator { /** * Determines whether the user represented by the supplied < tt > Authentication < / tt >
 * object is allowed to invoke the supplied URI .
 * @ param uri the URI excluding the context path ( a default context path setting will
 * be used ) */
public boolean isAllowed ( String uri , Authentication authentication ) { } }

implementation: return isAllowed ( null , uri , null , authentication ) ;


signature:
public class DefaultWebInvocationPrivilegeEvaluator { /** * Determines whether the user represented by the supplied < tt > Authentication < / tt >
 * object is allowed to invoke the supplied URI , with the given .
 * Note the default implementation of < tt > FilterInvocationSecurityMetadataSource < / tt >
 * disregards the < code > contextPath < / code > when evaluating which secure object
 * metadata applies to a given request URI , so generally the < code > contextPath < / code >
 * is unimportant unless you are using a custom
 * < code > FilterInvocationSecurityMetadataSource < / code > .
 * @ param uri the URI excluding the context path
 * @ param contextPath the context path ( may be null , in which case a default value
 * will be used ) .
 * @ param method the HTTP method ( or null , for any method )
 * @ param authentication the < tt > Authentication < / tt > instance whose authorities should
 * be used in evaluation whether access should be granted .
 * @ return true if access is allowed , false if denied */
public boolean isAllowed ( String contextPath , String uri , String method , Authentication authentication ) { } }

implementation: Assert . notNull ( uri , "uri parameter is required" ) ; FilterInvocation fi = new FilterInvocation ( contextPath , uri , method ) ; Collection < ConfigAttribute > attrs = securityInterceptor . obtainSecurityMetadataSource ( ) . getAttributes ( fi ) ; if ( attrs == null ) { if ( securityInterceptor . isRejectPublicInvocations ( ) ) { return false ; } return true ; } if ( authentication == null ) { return false ; } try { securityInterceptor . getAccessDecisionManager ( ) . decide ( authentication , fi , attrs ) ; } catch ( AccessDeniedException unauthorized ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( fi . toString ( ) + " denied for " + authentication . toString ( ) , unauthorized ) ; } return false ; } return true ;


signature:
public class MvcRequestMatcher { /** * ( non - Javadoc )
 * @ see org . springframework . security . web . util . matcher . RequestVariablesExtractor #
 * extractUriTemplateVariables ( javax . servlet . http . HttpServletRequest ) */
@ Override public Map < String , String > extractUriTemplateVariables ( HttpServletRequest request ) { } }

implementation: MatchableHandlerMapping mapping = getMapping ( request ) ; if ( mapping == null ) { return this . defaultMatcher . extractUriTemplateVariables ( request ) ; } RequestMatchResult result = mapping . match ( request , this . pattern ) ; return result == null ? Collections . < String , String > emptyMap ( ) : result . extractUriTemplateVariables ( ) ;


signature:
public class ProxyTicketSampleServlet { /** * Initialize the target URL . It allows for the host to change based upon the
 * " cas . service . host " system property . If the property is not set , the default is
 * " localhost : 8443 " . */
@ Override public void init ( ) throws ServletException { } }

implementation: super . init ( ) ; String casServiceHost = System . getProperty ( "cas.service.host" , "localhost:8443" ) ; targetUrl = "https://" + casServiceHost + "/cas-sample/secure/" ;


signature: public class SavedRequestAwareWrapper { @ Override public long getDateHeader ( String name ) { } }

implementation:
String value = getHeader ( name ) ; if ( value == null ) { return - 1L ; } // Attempt to convert the date header in a variety of formats
long result = FastHttpDateFormat . parseDate ( value , formats ) ; if ( result != - 1L ) { return result ; } throw new IllegalArgumentException ( value ) ;


signature:
public class SavedRequestAwareWrapper { /** * If the parameter is available from the wrapped request then the request has been
 * forwarded / included to a URL with parameters , either supplementing or overriding the
 * saved request values .
 * In this case , the value from the wrapped request should be used .
 * If the value from the wrapped request is null , an attempt will be made to retrieve
 * the parameter from the saved request . */
@ Override public String getParameter ( String name ) { } }

implementation: String value = super . getParameter ( name ) ; if ( value != null ) { return value ; } String [ ] values = savedRequest . getParameterValues ( name ) ; if ( values == null || values . length == 0 ) { return null ; } return values [ 0 ] ;


signature:
public class RequestAttributeAuthenticationFilter { /** * Read and returns the variable named by { @ code principalEnvironmentVariable } from
 * the request .
 * @ throws PreAuthenticatedCredentialsNotFoundException if the environment variable is
 * missing and { @ code exceptionIfVariableMissing } is set to { @ code true } . */
protected Object getPreAuthenticatedPrincipal ( HttpServletRequest request ) { } }

implementation: String principal = ( String ) request . getAttribute ( principalEnvironmentVariable ) ; if ( principal == null && exceptionIfVariableMissing ) { throw new PreAuthenticatedCredentialsNotFoundException ( principalEnvironmentVariable + " variable not found in request." ) ; } return principal ;


signature:
public class RegisterSessionAuthenticationStrategy { /** * In addition to the steps from the superclass , the sessionRegistry will be updated
 * with the new session information . */
public void onAuthentication ( Authentication authentication , HttpServletRequest request , HttpServletResponse response ) { } }

implementation: sessionRegistry . registerNewSession ( request . getSession ( ) . getId ( ) , authentication . getPrincipal ( ) ) ;


signature:
public class MethodSecurityInterceptor { /** * This method should be used to enforce security on a < code > MethodInvocation < / code > .
 * @ param mi The method being invoked which requires a security decision
 * @ return The returned value from the method invocation ( possibly modified by the
 * { @ code AfterInvocationManager } ) .
 * @ throws Throwable if any error occurs */
public Object invoke ( MethodInvocation mi ) throws Throwable { } }

implementation: InterceptorStatusToken token = super . beforeInvocation ( mi ) ; Object result ; try { result = mi . proceed ( ) ; } finally { super . finallyInvocation ( token ) ; } return super . afterInvocation ( token , result ) ;


signature:
public class ContactManagerBackend { /** * This is a public method . */
@ Transactional ( readOnly = true ) public Contact getRandomContact ( ) { } }

implementation: logger . debug ( "Returning random contact" ) ; Random rnd = new Random ( ) ; List < Contact > contacts = contactDao . findAll ( ) ; int getNumber = rnd . nextInt ( contacts . size ( ) ) ; return contacts . get ( getNumber ) ;


signature: public class EhCacheBasedAclCache { public void evictFromCache ( Serializable pk ) { } }

implementation: Assert . notNull ( pk , "Primary key (identifier) required" ) ; MutableAcl acl = getFromCache ( pk ) ; if ( acl != null ) { cache . remove ( acl . getId ( ) ) ; cache . remove ( acl . getObjectIdentity ( ) ) ; }


signature:
public class SecurityConfigurerAdapter { /** * Performs post processing of an object . The default is to delegate to the
 * { @ link ObjectPostProcessor } .
 * @ param object the Object to post process
 * @ return the possibly modified Object to use */
@ SuppressWarnings ( "unchecked" ) protected < T > T postProcess ( T object ) { } }

implementation: return ( T ) this . objectPostProcessor . postProcess ( object ) ;


signature:
public class SimpleUrlAuthenticationSuccessHandler { /** * Calls the parent class { @ code handle ( ) } method to forward or redirect to the target
 * URL , and then calls { @ code clearAuthenticationAttributes ( ) } to remove any leftover
 * session data . */
public void onAuthenticationSuccess ( HttpServletRequest request , HttpServletResponse response , Authentication authentication ) throws IOException , ServletException { } }

implementation: handle ( request , response , authentication ) ; clearAuthenticationAttributes ( request ) ;


signature:
public class SimpleUrlAuthenticationSuccessHandler { /** * Removes temporary authentication - related data which may have been stored in the
 * session during the authentication process . */
protected final void clearAuthenticationAttributes ( HttpServletRequest request ) { } }

implementation: HttpSession session = request . getSession ( false ) ; if ( session == null ) { return ; } session . removeAttribute ( WebAttributes . AUTHENTICATION_EXCEPTION ) ;


signature:
public class FieldUtils { /** * Attempts to locate the specified field on the class .
 * @ param clazz the class definition containing the field
 * @ param fieldName the name of the field to locate
 * @ return the Field ( never null )
 * @ throws IllegalStateException if field could not be found */
public static Field getField ( Class < ? > clazz , String fieldName ) throws IllegalStateException { } }

implementation:
Assert . notNull ( clazz , "Class required" ) ; Assert . hasText ( fieldName , "Field name required" ) ; try { return clazz . getDeclaredField ( fieldName ) ; } catch ( NoSuchFieldException nsf ) { // Try superclass
if ( clazz . getSuperclass ( ) != null ) { return getField ( clazz . getSuperclass ( ) , fieldName ) ; } throw new IllegalStateException ( "Could not locate field '" + fieldName + "' on class " + clazz ) ; }


signature:
public class FieldUtils { /** * Returns the value of a ( nested ) field on a bean . Intended for testing .
 * @ param bean the object
 * @ param fieldName the field name , with " . " separating nested properties
 * @ return the value of the nested field */
public static Object getFieldValue ( Object bean , String fieldName ) throws IllegalAccessException { } }

implementation: Assert . notNull ( bean , "Bean cannot be null" ) ; Assert . hasText ( fieldName , "Field name required" ) ; String [ ] nestedFields = StringUtils . tokenizeToStringArray ( fieldName , "." ) ; Class < ? > componentClass = bean . getClass ( ) ; Object value = bean ; for ( String nestedField : nestedFields ) { Field field = getField ( componentClass , nestedField ) ; field . setAccessible ( true ) ; value = field . get ( value ) ; if ( value != null ) { componentClass = value . getClass ( ) ; } } return value ;


signature: public class CasAuthenticationEntryPoint { public void afterPropertiesSet ( ) throws Exception { } }

implementation: Assert . hasLength ( this . loginUrl , "loginUrl must be specified" ) ; Assert . notNull ( this . serviceProperties , "serviceProperties must be specified" ) ; Assert . notNull ( this . serviceProperties . getService ( ) , "serviceProperties.getService() cannot be null." ) ;


signature:
public class CasAuthenticationEntryPoint { /** * Constructs a new Service Url . The default implementation relies on the CAS client
 * to do the bulk of the work .
 * @ param request the HttpServletRequest
 * @ param response the HttpServlet Response
 * @ return the constructed service url . CANNOT be NULL . */
protected String createServiceUrl ( final HttpServletRequest request , final HttpServletResponse response ) { } }

implementation: return CommonUtils . constructServiceUrl ( null , response , this . serviceProperties . getService ( ) , null , this . serviceProperties . getArtifactParameter ( ) , this . encodeServiceUrlWithSessionId ) ;


signature:
public class CasAuthenticationEntryPoint { /** * Constructs the Url for Redirection to the CAS server . Default implementation relies
 * on the CAS client to do the bulk of the work .
 * @ param serviceUrl the service url that should be included .
 * @ return the redirect url . CANNOT be NULL . */
protected String createRedirectUrl ( final String serviceUrl ) { } }

implementation: return CommonUtils . constructRedirectUrl ( this . loginUrl , this . serviceProperties . getServiceParameter ( ) , serviceUrl , this . serviceProperties . isSendRenew ( ) , false ) ;


signature:
public class RoleHierarchyImpl { /** * Set the role hierarchy and pre - calculate for every role the set of all reachable
 * roles , i . e . all roles lower in the hierarchy of every given role . Pre - calculation
 * is done for performance reasons ( reachable roles can then be calculated in O ( 1)
 * time ) . During pre - calculation , cycles in role hierarchy are detected and will cause
 * a < tt > CycleInRoleHierarchyException < / tt > to be thrown .
 * @ param roleHierarchyStringRepresentation - String definition of the role hierarchy . */
public void setHierarchy ( String roleHierarchyStringRepresentation ) { } }

implementation: this . roleHierarchyStringRepresentation = roleHierarchyStringRepresentation ; logger . debug ( "setHierarchy() - The following role hierarchy was set: " + roleHierarchyStringRepresentation ) ; buildRolesReachableInOneStepMap ( ) ; buildRolesReachableInOneOrMoreStepsMap ( ) ;