atlassian_connect_host 0.5.7

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 0

Atlassian Connect Host Services

Introduction

Provides services for Atlassian product host related activities such as:

  • automatically installing the addon on startup (dev mode only)
  • handling product host installation lifecycle events
  • signing (jwt) requests to the host
  • persisting host registration information (with pluggable persistence providers)
  • authenticating requests from an Atlassian host
  • creating addon session tokens (based on information from host request)
  • authenticating addon session tokens

This library can be used on it's own (e.g. as part of your own custom Dart based Atlassian Connect client framework) or as part of the Atlassian Connect Shelf based server.

Using

Basic Usage

Create a Host Registration Repository

The library provides an interface for repository implementations. The interface is very simple

abstract class AcHostRegistrationRepository {

  Future<AcHostRegistration> create(AcHostRegistration hostRegistration);

  Future<Option<AcHostRegistration>> findRegistrationByHostKey(String hostKey);
}

It consists of one method to create a new registration entry and one to look up by host key.

You can create your own implementation to whatever data store you like without much effort.

Currently, two implementations are provided out of the box

  • AcHostRegistrationInMemoryTestRepository. A simple in memory implementation suitable for testing and development mode only. It is very convenient as it doesn't require any set up
  • AcHostRegistrationMongoRepository. A Mongo DB implementation

To create a Mongo DB repository first follow instructions on setting up a mongo instance then call

DB db // create the mongo client DB object

final repo = new AcHostRegistrationMongoRepository(db);

Create an AddonHost object

An AddonHost represents (surprisingly) the addon host itself. Create one like so

final addonHost = new AddonHost(addonKey, baseUrl, addonSecret);

Note the addonSecret is only needed if you want to use the addon session token mechanism.

Create the AcHostService object

Now you have all you need to create a host service object

final hostService = new AcHostService(repo, addonHost);

Now you can use it as follows.

Initiate Host Installation (dev mode)

The following will attempt to contact the host with the give base url and initiate installation of the addon

hostService.installAddonToHost(hostBaseUri);

Handle the Installation Event by Registering the Host

When you get an installation lifecycle event from a host, call the registerHost method with the event (after decoding the json)

hostService.registerHost(installationEvent);

Send an HTTP Request to a Host

For example the following sends a request to Jira to fetch an issue

final jiraResponse = hostService.httpClientForHostKey(hostKey)
    .then((httpClient) => httpClient.get('rest/api/2/issue/$issueKey', signRequest: true))
    .then((req) => req.close());

jiraResponse
    .then(HttpBodyHandler.processResponse)
    .then((body) {   
       Map issueJson = body.body;
       // do something with the issue json
    });

0.4.0

  • Hipchat support
  • use enums
  • remove mutable variants of models

0.3.4

  • disable pk check

0.3.2

  • updated jwt to 0.2.2

0.3.1

  • updated jwt to 0.2.1

0.3.0

  • updated jwt to 0.2.0

0.2.0

  • Exclude context path from addons canoncial uri when authenticating requests from host

0.1.1

  • Make sure no registration exists for host key to prevent hijacking

0.1.0+2

  • fixed npe in in memory repo

0.1.0+1

  • upgraded min sdk version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  atlassian_connect_host: ^0.5.7

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:atlassian_connect_host/atlassian_connect_host.dart';
  
Version Uploaded Documentation Archive
0.5.7 Apr 10, 2016 Go to the documentation of atlassian_connect_host 0.5.7 Download atlassian_connect_host 0.5.7 archive
0.5.6 Mar 11, 2016 Go to the documentation of atlassian_connect_host 0.5.6 Download atlassian_connect_host 0.5.6 archive
0.5.5 Mar 11, 2016 Go to the documentation of atlassian_connect_host 0.5.5 Download atlassian_connect_host 0.5.5 archive
0.5.4 Oct 28, 2015 Go to the documentation of atlassian_connect_host 0.5.4 Download atlassian_connect_host 0.5.4 archive
0.5.3 Aug 20, 2015 Go to the documentation of atlassian_connect_host 0.5.3 Download atlassian_connect_host 0.5.3 archive
0.5.2 Aug 12, 2015 Go to the documentation of atlassian_connect_host 0.5.2 Download atlassian_connect_host 0.5.2 archive
0.5.1 Jul 14, 2015 Go to the documentation of atlassian_connect_host 0.5.1 Download atlassian_connect_host 0.5.1 archive
0.5.0 Jul 14, 2015 Go to the documentation of atlassian_connect_host 0.5.0 Download atlassian_connect_host 0.5.0 archive
0.4.0 Dec 12, 2014 Go to the documentation of atlassian_connect_host 0.4.0 Download atlassian_connect_host 0.4.0 archive
0.3.5+1 Sep 17, 2014 Go to the documentation of atlassian_connect_host 0.3.5+1 Download atlassian_connect_host 0.3.5+1 archive

All 26 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.9.0 <2.0.0