Add authorities for Stateless REST API FIlter

I want to implement Authentication by referring to a yaml file for user details and associated groups.

I am referring to this class StatelessUserAuthenticationFilter.

org.springframework.security.core.Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        groupIds = authentication.getAuthorities().stream()
                .map(res -> res.getAuthority())
                .map(res -> res.substring(5))
                .collect(Collectors.toList());

I am confused as to how the authentication details are persisted and retrieved from getAuthorities.
Does Camunda persist from a specific file? Or Spring AuthenticationManagerBuilder is to be used to fetch details from either of the three sources (in-memory, JDBC or LDAP)?