Clover Coverage Report - Atlassian Trusted Apps(Aggregated)
Coverage timestamp: Tue Jun 9 2009 19:34:44 CDT
12   52   5   2.4
0   36   0.42   5
5     1  
1    
 
 
  DefaultCurrentApplication       Line # 6 12 5 100% 1.0
 
  (12)
 
1    package com.atlassian.security.auth.trustedapps;
2   
3    import java.security.PrivateKey;
4    import java.security.PublicKey;
5   
 
6    public class DefaultCurrentApplication implements CurrentApplication
7    {
8    private final EncryptionProvider encryptionProvider;
9   
10    protected final String id;
11    protected final PublicKey publicKey;
12    protected final PrivateKey privateKey;
13   
 
14  14 toggle public DefaultCurrentApplication(EncryptionProvider encryptionProvider, PublicKey publicKey, PrivateKey privateKey, String id)
15    {
16  14 Null.not("encryptionProvider", encryptionProvider);
17  14 Null.not("publicKey", publicKey);
18  14 Null.not("privateKey", privateKey);
19  14 Null.not("id", id);
20   
21  14 this.encryptionProvider = encryptionProvider;
22  14 this.publicKey = publicKey;
23  14 this.privateKey = privateKey;
24  14 this.id = id;
25    }
26   
 
27  13 toggle public DefaultCurrentApplication(PublicKey publicKey, PrivateKey privateKey, String id)
28    {
29  13 this(new BouncyCastleEncryptionProvider(), publicKey, privateKey, id);
30    }
31   
32    /**
33    * Returned String can be used as a certificate to talk
34    * to the server that trusts this application. I.e. the ID of this app and the certificate go into the following header parameters:
35    * {@link CurrentApplication#HEADER_TRUSTED_APP_CERT}
36    * {@link CurrentApplication#HEADER_TRUSTED_APP_ID}
37    */
 
38  11 toggle public EncryptedCertificate encode(String userName)
39    {
40  11 return encryptionProvider.createEncryptedCertificate(userName, privateKey, getID());
41    }
42   
 
43  12 toggle public String getID()
44    {
45  12 return id;
46    }
47   
 
48  2 toggle public PublicKey getPublicKey()
49    {
50  2 return publicKey;
51    }
52    }