java.lang.Object | |
↳ | com.atlassian.applinks.core.auth.ApplicationLinkRequestFactoryFactoryImpl.AbsoluteURLRequestFactory |
Known Direct Subclasses |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
requestFactory |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a request of the given method type to the given url.
| |||||||||||
The URI that can be used to configure authentication for the requested resource. | |||||||||||
Provides a URI that can be used to configure authentication for the
requested resource.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.atlassian.applinks.api.ApplicationLinkRequestFactory
| |||||||||||
From interface
com.atlassian.applinks.api.AuthorisationURIGenerator
|
Creates a request of the given method type to the given url. ApplicationLinkRequestFactory implementations can
be transparently authenticated by different AuthenticationProvider
s. See
createAuthenticatedRequestFactory()
for more details.
Example usage:
ApplicationLinkRequestFactory
requestFactory =createAuthenticatedRequestFactory()
;ApplicationLinkRequest
request; try { request = requestFactory.createRequest(GET
, "/rest/my-plugin/1.0/my-resource"); } catch (CredentialsRequiredException
e) { // we don't have credentials stored for the context user, so prompt user to authenticate // using the URI provided bygetAuthorisationURI()
// ... } try { boolean success = request.execute(newApplicationLinkResponseHandler
<Boolean>() { Boolean handle(Response response) throws ResponseException { return response.isSuccessful()
) } Boolean credentialsRequired(Response response) throws ResponseException { // the remote server rejected our credentials, so prompt the user to authenticate // using the URI provided bygetAuthorisationURI()
// ... } }); } catch (ResponseException re) { // the request failed to complete normally }
methodType | The HTTP method type |
---|---|
uri | The target of the request. If you specify a URI that does not start with a protocol string
(e.g. http: or https:) the target ApplicationLink 's rpcUrl will be pre-pended to the request
URI. Specified absolute URIs will be used as is. |
ApplicationLinkRequest
objectCredentialsRequiredException |
---|
The URI that can be used to configure authentication for the requested resource.
The typical scenario is a call to an OAuth-protected remote resource for which the caller does not have an access token. If the caller has the ability to send a redirect (in case of a plugin servlet or webwork action), it would do so using this URL. This URL will take the user to a local endpoint that will perform the "OAuth dance":
If the caller does not have the ability to perform an HTTP redirect to this URL (possibly because it's a Web Panel), it can display a link or button that will open the URL in a popup dialog with an iframe, allowing the user to perform the oauth dance at a later time.
callback | the URI to redirect to after authentication is complete |
---|
getAuthorisationURI()
MUST
also return a non-null value.
Provides a URI that can be used to configure authentication for the
requested resource. This URI will not result in a callback.
ApplicationLinkRequestFactory implementations that support authorisation
URIs must return non-null values for this method at a minimum. Support for
getAuthorisationURI(URI)
is optional.
getAuthorisationURI(URI)
returns a non-null value, this method MUST also return
a non-null value.