GrantedAuthoritiesService.java

1
package edu.ucsb.cs156.courses.services;
2
3
import java.util.Collection;
4
import lombok.extern.slf4j.Slf4j;
5
import org.springframework.security.core.Authentication;
6
import org.springframework.security.core.GrantedAuthority;
7
import org.springframework.security.core.context.SecurityContext;
8
import org.springframework.security.core.context.SecurityContextHolder;
9
import org.springframework.stereotype.Service;
10
11
@Slf4j
12
@Service("grantedAuthorities")
13
public class GrantedAuthoritiesService {
14
15
  public Collection<? extends GrantedAuthority> getGrantedAuthorities() {
16
    SecurityContext securityContext = SecurityContextHolder.getContext();
17
    Authentication authentication = securityContext.getAuthentication();
18
    Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
19
    log.info("authorities={}", authorities);
20 1 1. getGrantedAuthorities : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/GrantedAuthoritiesService::getGrantedAuthorities → KILLED
    return authorities;
21
  }
22
}

Mutations

20

1.1
Location : getGrantedAuthorities
Killed by : edu.ucsb.cs156.courses.services.GrantedAuthoritiesServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.GrantedAuthoritiesServiceTests]/[method:test_getGrantedAuthorities()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/GrantedAuthoritiesService::getGrantedAuthorities → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3