public class

AddConsumerReciprocalServlet

extends AbstractOAuthConfigServlet
java.lang.Object
   ↳ javax.servlet.GenericServlet
     ↳ javax.servlet.http.HttpServlet
       ↳ com.atlassian.applinks.ui.AbstractApplinksServlet
         ↳ com.atlassian.applinks.ui.AbstractAppLinksAdminOnlyServlet
           ↳ com.atlassian.applinks.core.auth.AbstractAuthServlet
             ↳ com.atlassian.applinks.core.auth.oauth.servlets.AbstractOAuthConfigServlet
               ↳ com.atlassian.applinks.core.auth.oauth.servlets.serviceprovider.AddConsumerReciprocalServlet

Class Overview

This servlet is the counterpart of AddConsumerByUrlServlet and AddConsumerManuallyServlet.

Both those servlets redirect to this servlet on the other machine so oauth can be added as an outbound authentication provider on this host. When this servlet finishes, it redirects back to caller with a URL parameter to signify success or failure (for instance when this is a one-way link and the server id is not registered on this host -- which is possible when the process was initiated by a user that is logged in on the remote host and didn't realize).

This "cross-host dance" to establish an oauth link can fail for several reasons:

  • the link is one-way and the server id isn't registered on this host
  • the user accessing this servlet does not have admin privileges
  • the server has no access at all and cannot even log in to this host
As a result, it's important the calling servlet does not make any local state changes if the reciprocal operation failed.

This servlet takes to following url parameters:

  • callback=[absolute-url]

When redirecting back to callback, the following parameters are sent:

  • success=[true|false]
  • message=[description] -- optional parameter used to describe the error

This servlet is bound under: [PUT|DELETE] /applinks/auth/conf/oauth/outbound/apl/?callback=url To enable oauth for outbound requests to the specified Application Links, use PUT. To disable the oauth authentication provider, use DELETE.

Summary

Constants
String CALLBACK_PARAM
String ENABLE_OAUTH_AUTHENTICATION_PARAMETER
String SUCCESS_PARAM
[Expand]
Inherited Constants
From class com.atlassian.applinks.core.auth.oauth.servlets.AbstractOAuthConfigServlet
From class com.atlassian.applinks.ui.AbstractApplinksServlet
From interface com.atlassian.applinks.ui.XsrfProtectedServlet
[Expand]
Inherited Fields
From class com.atlassian.applinks.core.auth.AbstractAuthServlet
From class com.atlassian.applinks.ui.AbstractAppLinksAdminOnlyServlet
From class com.atlassian.applinks.ui.AbstractApplinksServlet
Public Constructors
AddConsumerReciprocalServlet(I18nResolver i18nResolver, MessageFactory messageFactory, TemplateRenderer templateRenderer, WebResourceManager webResourceManager, ApplicationLinkService applicationLinkService, AdminUIAuthenticator adminUIAuthenticator, AuthenticationConfigurationManager authenticationConfigurationManager, ConsumerTokenStoreService consumerTokenStoreService, InternalHostApplication internalHostApplication, BatchedJSONi18NBuilderFactory batchedJSONi18NBuilderFactory, LoginUriProvider loginUriProvider, DocumentationLinker documentationLinker, WebSudoManager webSudoManager, XsrfTokenAccessor xsrfTokenAccessor, XsrfTokenValidator xsrfTokenValidator)
Public Methods
static String getReciprocalServletUrl(URI baseUrl, ApplicationId applicationId, String callbackUrl, String actionParamValue)
Protected Methods
void doGet(HttpServletRequest request, HttpServletResponse resp)
[Expand]
Inherited Methods
From class com.atlassian.applinks.core.auth.oauth.servlets.AbstractOAuthConfigServlet
From class com.atlassian.applinks.core.auth.AbstractAuthServlet
From class com.atlassian.applinks.ui.AbstractAppLinksAdminOnlyServlet
From class com.atlassian.applinks.ui.AbstractApplinksServlet
From class javax.servlet.http.HttpServlet
From class javax.servlet.GenericServlet
From class java.lang.Object
From interface javax.servlet.Servlet
From interface javax.servlet.ServletConfig

Constants

public static final String CALLBACK_PARAM

Constant Value: "callback"

public static final String ENABLE_OAUTH_AUTHENTICATION_PARAMETER

Constant Value: "enable-oauth"

public static final String SUCCESS_PARAM

Constant Value: "success"

Public Constructors

public AddConsumerReciprocalServlet (I18nResolver i18nResolver, MessageFactory messageFactory, TemplateRenderer templateRenderer, WebResourceManager webResourceManager, ApplicationLinkService applicationLinkService, AdminUIAuthenticator adminUIAuthenticator, AuthenticationConfigurationManager authenticationConfigurationManager, ConsumerTokenStoreService consumerTokenStoreService, InternalHostApplication internalHostApplication, BatchedJSONi18NBuilderFactory batchedJSONi18NBuilderFactory, LoginUriProvider loginUriProvider, DocumentationLinker documentationLinker, WebSudoManager webSudoManager, XsrfTokenAccessor xsrfTokenAccessor, XsrfTokenValidator xsrfTokenValidator)

Public Methods

public static String getReciprocalServletUrl (URI baseUrl, ApplicationId applicationId, String callbackUrl, String actionParamValue)

Protected Methods

protected void doGet (HttpServletRequest request, HttpServletResponse resp)

Throws
ServletException
IOException