FernetSecretFeature.java

1
/**
2
   Copyright 2018 Carlos Macasaet
3
4
   Licensed under the Apache License, Version 2.0 (the "License");
5
   you may not use this file except in compliance with the License.
6
   You may obtain a copy of the License at
7
8
       https://www.apache.org/licenses/LICENSE-2.0
9
10
   Unless required by applicable law or agreed to in writing, software
11
   distributed under the License is distributed on an "AS IS" BASIS,
12
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
   See the License for the specific language governing permissions and
14
   limitations under the License.
15
 */
16
package com.macasaet.fernet.jersey;
17
18
import javax.ws.rs.core.Feature;
19
import javax.ws.rs.core.FeatureContext;
20
21
import com.macasaet.fernet.jaxrs.exception.IllegalTokenExceptionMapper;
22
import com.macasaet.fernet.jaxrs.exception.TokenValidationExceptionMapper;
23
24
/**
25
 * {@link Feature} that enables Fernet payload injection into Resource method parameters. In order to use this, the
26
 * application will also need to register a custom {@link com.macasaet.fernet.Validator Validator} that extracts the
27
 * payload from the token and a {@link java.util.function.Supplier Supplier<Collection<Key>>} that provides
28
 * valid Fernet keys.
29
 *
30
 * <p>Copyright &copy; 2018 Carlos Macasaet.</p>
31
 *
32
 * @author Carlos Macasaet
33
 * @see com.macasaet.fernet.jaxrs.FernetSecret
34
 */
35
public class FernetSecretFeature implements Feature {
36
37
    public boolean configure(final FeatureContext context) {
38
        context.register(new FernetSecretBinder());
39
        context.register(TokenValidationExceptionMapper.class);
40
        context.register(IllegalTokenExceptionMapper.class);
41 1 1. configure : replaced return of integer sized value with (x == 0 ? 1 : 0) → SURVIVED
        return true;
42
    }
43
44
}

Mutations

41

1.1
Location : configure
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → SURVIVED

Active mutators

Tests examined


Report generated by PIT 1.4.10