| 1 |
|
package com.atlassian.security.auth.trustedapps; |
| 2 |
|
|
| 3 |
|
import java.security.KeyPair; |
| 4 |
|
import java.security.NoSuchAlgorithmException; |
| 5 |
|
import java.security.NoSuchProviderException; |
| 6 |
|
import java.util.HashMap; |
| 7 |
|
import java.util.Map; |
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 6 |
Complexity Density: 0.46 |
|
| 12 |
|
public class DefaultTrustedApplicationsManager implements TrustedApplicationsManager |
| 13 |
|
{ |
| 14 |
|
protected final CurrentApplication application; |
| 15 |
|
protected final Map trustedApps; |
| 16 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 17 |
3
|
public DefaultTrustedApplicationsManager(CurrentApplication application, Map trustedApps)... |
| 18 |
|
{ |
| 19 |
3
|
Null.not("application", application); |
| 20 |
2
|
Null.not("trustedApps", trustedApps); |
| 21 |
|
|
| 22 |
1
|
this.application = application; |
| 23 |
1
|
this.trustedApps = trustedApps; |
| 24 |
|
} |
| 25 |
|
|
| 26 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 27 |
|
public DefaultTrustedApplicationsManager()... |
| 28 |
|
{ |
| 29 |
|
this(new BouncyCastleEncryptionProvider()); |
| 30 |
|
} |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 34 |
3
|
public DefaultTrustedApplicationsManager(EncryptionProvider encryptionProvider)... |
| 35 |
|
{ |
| 36 |
3
|
try |
| 37 |
|
{ |
| 38 |
3
|
KeyPair keyPair = encryptionProvider.generateNewKeyPair(); |
| 39 |
1
|
Null.not("keyPair", keyPair); |
| 40 |
|
|
| 41 |
1
|
application = new DefaultCurrentApplication(encryptionProvider, keyPair.getPublic(), keyPair.getPrivate(), encryptionProvider.generateUID()); |
| 42 |
1
|
trustedApps = new HashMap(); |
| 43 |
|
} |
| 44 |
|
catch (NoSuchAlgorithmException e) |
| 45 |
|
{ |
| 46 |
1
|
throw new AssertionError(e); |
| 47 |
|
} |
| 48 |
|
catch (NoSuchProviderException e) |
| 49 |
|
{ |
| 50 |
1
|
throw new AssertionError(e); |
| 51 |
|
} |
| 52 |
|
} |
| 53 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 54 |
6
|
public CurrentApplication getCurrentApplication()... |
| 55 |
|
{ |
| 56 |
6
|
return application; |
| 57 |
|
} |
| 58 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 59 |
2
|
public TrustedApplication getTrustedApplication(String id)... |
| 60 |
|
{ |
| 61 |
2
|
return (TrustedApplication) trustedApps.get(id); |
| 62 |
|
} |
| 63 |
|
} |