modules/spring-mock-mvc/src/main/java/io/restassured/module/mockmvc/RestAssuredMockMvc.java
public static MockMvcAuthenticationScheme authentication(final Object authentication) {
        return new MockMvcAuthenticationScheme() {
            public void authenticate(MockMvcRequestSpecification mockMvcRequestSpecification) {
                mockMvcRequestSpecification.auth().authentication(authentication);
            }
        };
    }
public static MockMvcAuthenticationScheme authentication(final Object authentication) {
        return new MockMvcAuthenticationScheme() {
            public void authenticate(MockMvcRequestSpecification mockMvcRequestSpecification) {
                mockMvcRequestSpecification.auth().authentication(authentication);
            }
        };
    }
public static MockMvcAuthenticationScheme authentication ( final Object authentication ) { return new MockMvcAuthenticationScheme ( ) { public void authenticate ( MockMvcRequestSpecification mockMvcRequestSpecification ) { mockMvcRequestSpecification . auth ( ) . authentication ( authentication ) ; } } ; }
Authenticate using the supplied authentication instance (<code>org.springframework.security.core.Authentication</code> from Spring Security). Used as:
<pre>
RestAssured.authentication = authentication(myAuth);
</pre>
or in a {@link MockMvcRequestSpecBuilder}:
<pre>
MockMvcRequestSpecification req = new MockMvcRequestSpecBuilder().setAuth(authentication(myAuth)). ..
</pre>

@param authentication The authentication instance to use.
@return A {@link MockMvcAuthenticationScheme} instance.
@see MockMvcAuthenticationSpecification#authentication(Object)
Authenticate using the supplied authentication instance ( <code > org . springframework . security . core . Authentication< / code > from Spring Security ) . Used as : <pre > RestAssured . authentication = authentication ( myAuth ) ; < / pre > or in a { @link MockMvcRequestSpecBuilder } : <pre > MockMvcRequestSpecification req = new MockMvcRequestSpecBuilder () . setAuth ( authentication ( myAuth )) . .. < / pre >