modules/spring-mock-mvc/src/main/java/io/restassured/module/mockmvc/RestAssuredMockMvc.java
public static MockMvcAuthenticationScheme principal(final Principal principal) {
        return new MockMvcAuthenticationScheme() {
            public void authenticate(MockMvcRequestSpecification mockMvcRequestSpecification) {
                mockMvcRequestSpecification.auth().principal(principal);
            }
        };
    }
public static MockMvcAuthenticationScheme principal(final Principal principal) {
        return new MockMvcAuthenticationScheme() {
            public void authenticate(MockMvcRequestSpecification mockMvcRequestSpecification) {
                mockMvcRequestSpecification.auth().principal(principal);
            }
        };
    }
public static MockMvcAuthenticationScheme principal ( final Principal principal ) { return new MockMvcAuthenticationScheme ( ) { public void authenticate ( MockMvcRequestSpecification mockMvcRequestSpecification ) { mockMvcRequestSpecification . auth ( ) . principal ( principal ) ; } } ; }
Authenticate using the given principal. Used as:
<pre>
RestAssured.authentication = principal(myPrincipal);
</pre>
or in a {@link MockMvcRequestSpecBuilder}:
<pre>
MockMvcRequestSpecification req = new MockMvcRequestSpecBuilder().setAuth(principal(myPrincipal)). ..
</pre>

@param principal The principal to use.
@return A {@link MockMvcAuthenticationScheme} instance.
@see MockMvcAuthenticationSpecification#principal(java.security.Principal)
Authenticate using the given principal . Used as : <pre > RestAssured . authentication = principal ( myPrincipal ) ; < / pre > or in a { @link MockMvcRequestSpecBuilder } : <pre > MockMvcRequestSpecification req = new MockMvcRequestSpecBuilder () . setAuth ( principal ( myPrincipal )) . .. < / pre >