1   package com.atlassian.security.auth.trustedapps;
2   
3   /**
4    * <p>
5    * An implementation of this component is provided by the host application.
6    * Use it to add or delete Trusted Applications.
7    * </p>
8    *
9    * @since v2.2
10   */
11  public interface TrustedApplicationsConfigurationManager
12  {
13      /**
14       * Retrieve the application certificate from some other application, over HTTP. Will look for the certificate at
15       * <code>${baseUrl}/admin/appTrustCertificate</code>.
16       *
17       * @param baseUrl
18       *            the base URL of the application to be queried
19       * @return the retrieved application certificate
20       * @throws com.atlassian.security.auth.trustedapps.ApplicationRetriever.RetrievalException
21       *             if there are problems with the certificate retrieved from the remote server or the server cannot be
22       *             contacted
23       * @throws RuntimeException
24       *             if there are problems retrieving the certificate from the remote server
25       */
26      Application getApplicationCertificate(String baseUrl) throws ApplicationRetriever.RetrievalException;
27  
28      /**
29       * Adds the specified Trusted Application. If an application with the
30       * specified ID already exists, the existing record will be replaced
31       * silently.
32       *
33       * @param conditions the conditions that incoming requests must meet in order
34       * to be accepted.
35       * @param app
36       * @return  the newly created or updated Trusted Application.
37       */
38      TrustedApplication addTrustedApplication(Application app, RequestConditions conditions);
39  
40      /**
41       * Removes the specified Trusted Application.
42       *
43       * @param id    the ID of the trusted application.
44       * @return  {@code true} if the Trusted Application with the specified ID
45       * was found and removed, {@code false} if the specified ID was not found.
46       */
47      boolean deleteApplication(String id);
48  
49      /**
50       * @return  all configured Trusted Applications.
51       */
52      Iterable<TrustedApplication> getTrustedApplications();
53  }