Uploaded image for project: 'atlassian-seraph'
  1. atlassian-seraph
  2. SER-104

Add method for generating trusted app headers for HTTP requests

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Medium
    • 0.34
    • 0.33
    • None
    • true

    Description

      A common pattern in trusted app clients is:

                  EncryptedCertificate cert = trustedApplicationsManager.getCurrentApplication().encode(user.getName());
                  request.addRequestHeader(CurrentApplication.HEADER_TRUSTED_APP_ID, cert.getID());
                  request.addRequestHeader(CurrentApplication.HEADER_TRUSTED_APP_CERT, cert.getCertificate());
                  request.addRequestHeader(CurrentApplication.HEADER_TRUSTED_APP_SECRET_KEY, cert.getSecretKey());
      

      while we don't want to make Seraph depend on HttpClient, there's no need for clients to know this many details of the headers. We should have:

      Map<String,String> trustHeaders = <something>.getHttpHeaders(cert);
      // add the headers in whatever manner your HTTP client requires...

      We could add this method to CurrentApplication and just pass the user, although that clutters the interface with HTTP specific assumptions....

      Attachments

        Activity

          People

            sleberrigaud Samuel Le Berrigaud
            tom@atlassian.com Tom Davies
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              16 years, 16 weeks, 5 days ago