Package com.atlassian.applinks.api
Interface ReadOnlyApplicationLink
- All Known Subinterfaces:
ApplicationLink
@PublicApi
public interface ReadOnlyApplicationLink
Represents a link to a remote application-level entity (JIRA, Confluence, Bamboo, etc). In contrast to
ApplicationLink, this one cannot be modified. Nevertheless, it is not advised to persist any instance
returned by this class - if really needed use the ApplicationId instead an listen for
ApplicationLinksIDChangedEvents.- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionTheApplicationLinkRequestFactoryreturned by this method will choose a singleAuthenticationProviderfor automatically authenticating createdRequestobjects.createAuthenticatedRequestFactory(Class<? extends AuthenticationProvider> providerClass) This method returns aApplicationLinkRequestFactoryinitialised by the specifiedAuthenticationProvider.Creates a request factory for impersonating requests (seeImpersonatingAuthenticationProvider).Creates a request factory for non-impersonating requests (seeNonImpersonatingAuthenticationProvider).getId()ThisApplicationIdis subject to change if an administrator: upgrades the remote application to use Unified Application Links (and this link was created prior to the upgrade); or the remote application does not have Unified Application Links deployed, and its RPC URL changes. If you are storing theApplicationIdfor any reason, your plugin should listen for theApplicationLinksIDChangedEvent.getName()default OAuth2ConnectionTypegetType()See thecom.atlassian.applinks.api.applicationpackage for a list ofApplicationTypes bundled with the Unified Application Links plugin.booleanbooleanisSystem()
-
Method Details
-
getId
ApplicationId getId()ThisApplicationIdis subject to change if an administrator:- upgrades the remote application to use Unified Application Links (and this link was created prior to the upgrade); or
- the remote application does not have Unified Application Links deployed, and its RPC URL changes.
ApplicationIdfor any reason, your plugin should listen for theApplicationLinksIDChangedEvent.- Returns:
- the globally unique ID of the server at the other end of this link.
-
getType
ApplicationType getType()See thecom.atlassian.applinks.api.applicationpackage for a list ofApplicationTypes bundled with the Unified Application Links plugin. Additional types can be added via the extension APIs in the applinks-spi module.- Returns:
- the type of the application e.g.
JiraApplicationType
-
getName
String getName()- Returns:
- a brief identifier for the linked application e.g. "My FishEye". Note that this property is never guaranteed to be unique or immutable. Do not use as primary key (use ID instead).
-
getDisplayUrl
URI getDisplayUrl()- Returns:
- the base URL to be used when constructing links that are sent to
clients, e.g. web browsers. The
URIreturned by this method will have no trailing slash. e.g. "https://mydomain.com/jira"
-
getRpcUrl
URI getRpcUrl()- Returns:
- the base URL to be used when constructing URIs to be used for RPC
calls to this application (e.g. xml-rpc, SOAP or REST requests). The
returned
URIwill have no trailing slash. e.g. "http://localhost:8080/jira"
-
isPrimary
boolean isPrimary()- Returns:
- true if this is the primary
ApplicationLinkof its type, false otherwise
-
isSystem
boolean isSystem()- Returns:
- true if this is a system link, false otherwise
-
getOAuth2ConnectionType
- Returns:
- the type of OAuth2 connection that the application link represents. Returns null for any application links that didn't come from the OAuth2 plugin.
- Since:
- 8.0.11
-
createAuthenticatedRequestFactory
ApplicationLinkRequestFactory createAuthenticatedRequestFactory()TheApplicationLinkRequestFactoryreturned by this method will choose a singleAuthenticationProviderfor automatically authenticating createdRequestobjects. The selection algorithm is as follows:- If no existing user context (checked by
UserManager.getRemoteUsername()), the request will be unauthenticated, and processed in the remote application anonymously. - If one or more
ImpersonatingAuthenticationProviders are configured (for example, OAuth or Trusted Applications), one will be used. Trusted Applications will be returned in preference to OAuth if both are configured; - else if one or more
NonImpersonatingAuthenticationProviders are configured (for example, Basic Auth), one will be used - else the request will be unauthenticated, and processed in the remote application anonymously.
AuthenticationProviders can be implemented via the extension APIs in the applinks-spi module. If your feature only supports a single authentication method, you should usecreateAuthenticatedRequestFactory(Class)}.- Returns:
- an
ApplicationLinkRequestFactoryfor creating requests that are authenticated for thisApplicationLink. - See Also:
- If no existing user context (checked by
-
createAuthenticatedRequestFactory
ApplicationLinkRequestFactory createAuthenticatedRequestFactory(Class<? extends AuthenticationProvider> providerClass) This method returns aApplicationLinkRequestFactoryinitialised by the specifiedAuthenticationProvider. You should use this method only if your feature requires a specificAuthenticationProviderimplementation. Note that this method will return null if an administrator of the local application has not configured the specifiedAuthenticationProviderfor thisApplicationLink.- Parameters:
providerClass- theAuthenticationProvidertype to use for theRequestFactory- Returns:
- a
RequestFactoryfor creating requests that are authenticated for thisApplicationLinkusing anAuthenticationProviderimplementation that conforms to the supplied providerClass, or null if noAuthenticationProvideris configured for thisApplicationLink. If the supplied providerClass isAuthenticationProvider.classthis method will bind theRequestFactoryto any availableAuthenticationProvider, or return null if there are noAuthenticationProviders configured. This method will only return an unauthenticatedRequestFactoryif the supplied providerClass isAnonymous. - See Also:
-
createImpersonatingAuthenticatedRequestFactory
ApplicationLinkRequestFactory createImpersonatingAuthenticatedRequestFactory()Creates a request factory for impersonating requests (seeImpersonatingAuthenticationProvider). The authentication providers will be considered in the strict order given in the following list. The first authentication mode supported by the product and configured on this link will be returned. -TrustedAppsAuthenticationProvider-TwoLeggedOAuthWithImpersonationAuthenticationProvider-OAuthAuthenticationProvider- Returns:
- request factory for impersonating requests, or null if no such factory is available on this link
- Since:
- 3.10
-
createNonImpersonatingAuthenticatedRequestFactory
ApplicationLinkRequestFactory createNonImpersonatingAuthenticatedRequestFactory()Creates a request factory for non-impersonating requests (seeNonImpersonatingAuthenticationProvider). The authentication providers will be considered in the strict order given in the following list. The first authentication mode supported by the product and configured on this link will be returned. -TwoLeggedOAuthAuthenticationProvider-BasicAuthenticationProvider- Returns:
- request factory for non-impersonating requests, or null if no such factory is available on this link
- Since:
- 3.10
-