atlassian_connect_shelf 0.3.0+1 copy "atlassian_connect_shelf: ^0.3.0+1" to clipboard
atlassian_connect_shelf: ^0.3.0+1 copied to clipboard

outdatedDart 1 only

Atlassian Connect Shelf based server. Includes middleware for authentication. Leverages all the other acdart components like jwt, host services and config

Atlassian Connect Shelf Server #

Introduction #

Provides a server based on the Shelf library.

It includes the following Shelf Middleware components:

  • productHostAuthenticator. A Shelf Middleware component for authenticating requests from product hosts
  • sessionTokenAuthenticator. A Shelf Middleware component for authenticating requests from the addon client code using the Atlassian Connect session token mechanism

In addition it includes:

  • AcDartRouteBuilder. A builder for creating routes using the Shelf Route library
  • startServer. A helper function for starting the Shelf http server

The Shelf Server uses all the other Atlassian Connect Dart libraries. It's the easiest way to get started and we believe provides a good solution. However, if you prefer another web framework then you can still use all the other Atlassian Connect Dart libraries, greatly reducing the effort to get up and running.

Using #

Basic Usage #

Note there is an example project that is in the example folder of the library that illustrates basic usage.

Create your Configuration

See the documentation for the Atlassian Connect Configuration library for details.

Define your Routes

Implement a function with the following signature

typedef RouteInitialiser(AcDartRouteBuilder routeBuilder, String addonKey, Uri addonBaseUri);

For example

void initRoutes(AcDartMainRouteBuilder routeBuilder, String addonKey, Uri addonBaseUri) {
  
  routeBuilder.addInstallationRoute();
  routeBuilder.addDescriptorTemplateRoute();
  
  routeBuilder.addJwtRoute(
      m.moustacheFile('../ui/exampleUI.html', includeExtraParams: true), 
      '/ui/exampleUI.html', method: 'GET');  

  routeBuilder.addHostServiceSessionTokenRoute(_fetchJiraIssue, '/issue/{$_ISSUE_KEY}');
}

This adds routes to handle the installation lifecycle event and to serve the atlassian-connect.json descriptor from a moustache template, in both cases using default values for url etc. Note these values are overrideable.

It also adds:

  • one route for serving request received from a host (e.g. from a web item) from /ui/exampleUI.html. This page will served with an addon session token and contains JavaScript to make a REST call back the addon host at /issue/{$_ISSUE_KEY}
  • one route to serve the REST requests from the addon client (in /ui/exampleUI.html).

Start Your Engines

Now you can fire up the server

void main() {
  startServer(initRoutes, config);
}

And away you go.

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Atlassian Connect Shelf based server. Includes middleware for authentication. Leverages all the other acdart components like jwt, host services and config

Homepage

License

unknown (license)

Dependencies

atlassian_connect_config, atlassian_connect_host, mustache, option, shelf, shelf_route

More

Packages that depend on atlassian_connect_shelf