1   package com.atlassian.security.auth.trustedapps;
2   
3   /**
4    * Represents current application. This object is used when establishing trust with other servers and requesting them to
5    * perform privileged operations for this application.
6    */
7   public interface CurrentApplication extends Application
8   {
9       /**
10       * @deprecated since 0.34 use {@link TrustedApplicationUtils.Header.Request#ID} instead.
11       */
12      @Deprecated
13      public static final String HEADER_TRUSTED_APP_ID = TrustedApplicationUtils.Header.Request.ID;
14  
15      /**
16       * @deprecated since 0.34 use {@link TrustedApplicationUtils.Header.Request#CERT} instead.
17       */
18      @Deprecated
19      public static final String HEADER_TRUSTED_APP_CERT = TrustedApplicationUtils.Header.Request.CERTIFICATE;
20  
21      /**
22       * @deprecated since 0.34 use {@link TrustedApplicationUtils.Header.Request#SECRET_KEY} instead.
23       */
24      @Deprecated
25      public static final String HEADER_TRUSTED_APP_SECRET_KEY = TrustedApplicationUtils.Header.Request.SECRET_KEY;
26  
27      /**
28       * @deprecated since 0.34 use {@link TrustedApplicationUtils.Header.Response#ERROR} instead.
29       */
30      @Deprecated
31      public static final String HEADER_TRUSTED_APP_ERROR = TrustedApplicationUtils.Header.Response.ERROR;
32  
33      /**
34       * @deprecated since 0.34 use {@link TrustedApplicationUtils.Header.Response#STATUS} instead.
35       */
36      @Deprecated
37      public static final String HEADER_TRUSTED_APP_STATUS = TrustedApplicationUtils.Header.Response.STATUS;
38  
39      /**
40       * Generates a new certificate that will be sent to the remote server when asking to perform privileged operation
41       * for this application.
42       * 
43       * @return encrypted certificate representing this application
44       * @throws InvalidCertificateException
45       * @deprecated since 2.4
46       * @see #encode(String, String)
47       */
48      EncryptedCertificate encode(String userName);
49      
50      /**
51       * <p>Generates a new certificate that will be sent to the remote server when asking to perform privileged operation
52       * for this application.</p>
53       * <p><code>urlToSign</code> should be non-null for a v2 request. Some servers may only accept
54       * v2 requests.</p>
55       * 
56       * @param urlToSign the target URL for this operation. If <code>null</code>, only a v1 certificate will be generated
57       * @return encrypted certificate representing this application
58       * @throws InvalidCertificateException
59       * @since 2.4
60       */
61      EncryptedCertificate encode(String userName, String urlToSign);
62  }