Annotation Type WithMockUser

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String[] authorities
      The authorities to use.
      java.lang.String password
      The password to be used.
      java.lang.String[] roles
      The roles to use.
      TestExecutionEvent setupBefore
      Determines when the SecurityContext is setup.
      java.lang.String username
      The username to be used.
      java.lang.String value
      Convenience mechanism for specifying the username.
    • Element Detail

      • value

        java.lang.String value
        Convenience mechanism for specifying the username. The default is "user". If username() is specified it will be used instead of value()
        Returns:
        Default:
        "user"
      • username

        java.lang.String username
        The username to be used. Note that value() is a synonym for username(), but if username() is specified it will take precedence.
        Returns:
        Default:
        ""
      • roles

        java.lang.String[] roles

        The roles to use. The default is "USER". A GrantedAuthority will be created for each value within roles. Each value in roles will automatically be prefixed with "ROLE_". For example, the default will result in "ROLE_USER" being used.

        If authorities() is specified this property cannot be changed from the default.

        Returns:
        Default:
        {"USER"}
      • authorities

        java.lang.String[] authorities

        The authorities to use. A GrantedAuthority will be created for each value.

        If this property is specified then roles() is not used. This differs from roles() in that it does not prefix the values passed in automatically.

        Returns:
        Default:
        {}
      • password

        java.lang.String password
        The password to be used. The default is "password".
        Returns:
        Default:
        "password"