1 | package fr.sii.ogham.email.sender.impl.javamail; | |
2 | ||
3 | import javax.mail.Authenticator; | |
4 | import javax.mail.PasswordAuthentication; | |
5 | ||
6 | import fr.sii.ogham.core.builder.configuration.ConfigurationValueBuilderHelper; | |
7 | ||
8 | /** | |
9 | * Basic authenticator that uses the provided username and password. | |
10 | * | |
11 | * @author Aurélien Baudet | |
12 | * | |
13 | */ | |
14 | public class UpdatableUsernamePasswordAuthenticator extends Authenticator { | |
15 | /** | |
16 | * The username for authentication | |
17 | */ | |
18 | private final ConfigurationValueBuilderHelper<?, String> usernameValueBuilder; | |
19 | ||
20 | /** | |
21 | * The password for authentication | |
22 | */ | |
23 | private final ConfigurationValueBuilderHelper<?, String> passwordValueBuilder; | |
24 | ||
25 | public UpdatableUsernamePasswordAuthenticator(ConfigurationValueBuilderHelper<?, String> usernameValueBuilder, ConfigurationValueBuilderHelper<?, String> passwordValueBuilder) { | |
26 | super(); | |
27 | this.usernameValueBuilder = usernameValueBuilder; | |
28 | this.passwordValueBuilder = passwordValueBuilder; | |
29 | } | |
30 | ||
31 | @Override | |
32 | protected PasswordAuthentication getPasswordAuthentication() { | |
33 | String username = usernameValueBuilder.getValue(); | |
34 | String password = passwordValueBuilder.getValue(); | |
35 |
1
1. getPasswordAuthentication : replaced return value with null for fr/sii/ogham/email/sender/impl/javamail/UpdatableUsernamePasswordAuthenticator::getPasswordAuthentication → NO_COVERAGE |
return new PasswordAuthentication(username, password); |
36 | } | |
37 | } | |
Mutations | ||
35 |
1.1 |