Clover icon

sunshower-core

  1. Project Clover database Fri Apr 6 2018 03:27:42 UTC
  2. Package io.sunshower.service.security

File TokenAuthenticationFilter.java

 

Coverage histogram

../../../../img/srcFileCovDistChart8.png
14% of files have more coverage

Code metrics

0
2
2
1
31
24
2
1
1
2
1

Classes

Class Line # Actions
TokenAuthenticationFilter 13 2 2
0.7575%
 

Contributing tests

This file is covered by 2 tests. .

Source view

1    package io.sunshower.service.security;
2   
3    import java.io.IOException;
4    import java.util.logging.Logger;
5    import javax.inject.Inject;
6    import javax.ws.rs.container.ContainerRequestContext;
7    import javax.ws.rs.container.ContainerResponseContext;
8    import javax.ws.rs.ext.Provider;
9    import org.springframework.stereotype.Service;
10   
11    @Service
12    @Provider
 
13    public class TokenAuthenticationFilter implements AuthenticationFilter {
14   
15    static final Logger log = Logger.getLogger(TokenAuthenticationFilter.class.getName());
16   
17    public static final String HEADER_KEY = "X-AUTH-TOKEN";
18   
19    @Inject private TokenManager tokenManager;
20   
 
21  2 toggle @Override
22    public void filter(ContainerRequestContext requestContext) throws IOException {
23  2 final String token = requestContext.getHeaderString(HEADER_KEY);
24  2 tokenManager.check(token);
25    }
26   
 
27  0 toggle @Override
28    public void filter(
29    ContainerRequestContext requestContext, ContainerResponseContext responseContext)
30    throws IOException {}
31    }