Example usage for org.springframework.security.core.authority.mapping SimpleAuthorityMapper setConvertToUpperCase

List of usage examples for org.springframework.security.core.authority.mapping SimpleAuthorityMapper setConvertToUpperCase

Introduction

In this page you can find the example usage for org.springframework.security.core.authority.mapping SimpleAuthorityMapper setConvertToUpperCase.

Prototype

public void setConvertToUpperCase(boolean convertToUpperCase) 

Source Link

Document

Whether to convert the authority value to upper case in the mapping.

Usage

From source file:org.keycloak.adapters.springsecurity.support.KeycloakSpringAdapterUtilsTest.java

@Before
public void setUp() throws Exception {

    MockitoAnnotations.initMocks(this);
    SimpleAuthorityMapper roleMapper = new SimpleAuthorityMapper();
    roleMapper.setConvertToUpperCase(true);
    grantedAuthoritiesMapper = roleMapper;

    PowerMockito.mockStatic(AdapterUtils.class);
    when(AdapterUtils.getRolesFromSecurityContext(any(RefreshableKeycloakSecurityContext.class)))
            .thenReturn(AUTHORITIES);/*from   w w w  .j  av  a  2 s . co m*/
    when(AdapterUtils.createPrincipal(eq(deployment), eq(context))).thenReturn(principal);
}