1   package com.atlassian.security.auth.trustedapps;
2   
3   import javax.servlet.http.HttpServletRequest;
4   
5   /**
6    * Represents a trusted remote application.
7    * This object used to verify a request claiming to have come from this application.
8    * Such a request is required to have an encrypted certificate and application ID.
9    * The certificate decryption and validation is a responsibility of this object.
10   */
11  public interface TrustedApplication extends Application
12  {
13  	/**
14  	 * This method decodes and validates the received certificate.
15  	 * 
16  	 * @param certificate - certificate string claiming to have come from this application
17  	 * 
18  	 * @return {@link ApplicationCertificate} object if validation succeeds
19  	 * 
20  	 * @throws InvalidCertificateException - if either decryption or validation fails
21  	 */
22  	ApplicationCertificate decode(EncryptedCertificate certificate, HttpServletRequest request) throws InvalidCertificateException;
23  
24      /**
25       * @since   v2.2
26       * @return  the conditions associated with this application. Requests
27       * that do not meet these conditions will not be authenticated.
28       */
29      RequestConditions getRequestConditions();
30  
31  
32      /**
33       * Returns the name of the trusted application. This method has been added for UAL,
34       * because JIRA and Confluence store the URL of the application by default as the name and UAL
35       * is interested in the URL of the application, to be able to create an application link for
36       * existing trusted application configurations.
37       *
38       * @since v2.3
39       *
40       * @return The name of the trusted application.
41       *         Can be null.
42       */
43      String getName();
44  }