AtlasCamp 2014: Writing Connect Add-ons for Confluence

1,252 views

Published on

This AtlasCamp, we're talking a lot about Atlassian Connect and the new Confluence REST API. This session will bring it all together with an overview on building a Connect add-on with Confluence. We will cover best practices when writing complex dynamic macros with respect to security, performance and maintainability.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,252
On SlideShare
0
From Embeds
0
Number of Embeds
108
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

AtlasCamp 2014: Writing Connect Add-ons for Confluence

  1. 1. June 3-5, 2014 | Berlin, Germany
  2. 2. @matthewjensen Matthew Jensen, Confluence Ecosystem, Atlassian Writing Connect Add-ons for Confluence
  3. 3. • About Me:! • Almost 7.5 years at Atlassian Introduction 81% 19%
  4. 4. • About Me:! • Almost 7.5 years at Atlassian! • Over four years on Confluence development Introduction 81% 9% 10%
  5. 5. Why is it so hard to write a Confluence plugin? — Matthew Jensen, Confluence Ecosystem ” “
  6. 6. Confluence Ecosystem
  7. 7. Confluence Platform Spaces Questions ? ?? ? ? ?
  8. 8. Connect and Confluence
  9. 9. SAME BUT DIFFERENT SAME
  10. 10. Confluence Connect DESIGN SECURITY PERFORMANCE MACROS
  11. 11. HiliteMe MACROS
  12. 12. Example Consider a macro to pretty print your code MACROS
  13. 13. Example MACROS This macro can make any code look great!
  14. 14. Example http://bitbucket.org/mjensen/hilite-me-addon MACROS
  15. 15. • Can be of any size! • Can contain sensitive information Macro Body CONFIDENTIAL MACROS
  16. 16. • Only use HTTP GET operations! • Flexibility! • This concern is new with Connect Macro Bodies MACROS
  17. 17. VSDynamic Macros Static Macros
  18. 18. Dynamic Content Macros Confluence Add onBrowser Request HTML IFrame Unformatted Code Formatted Requested Returned Macro Loaded MACROS
  19. 19. • Dynamic Content Macros are good:! • when they can take a while to load! • when it involves a third-party integration! • requires authentication to collect the body! • when your macro is block macro Dynamic Content Macros MACROS
  20. 20. Static Content Macros Confluence Add onBrowser Request Unformatted Code Formatted Code Requested Returned MACROS
  21. 21. • Static Content Macros are good:! • when you have many on the page! • when the body is small or not sensitive! • when you can avoid authentication Static Content Macros MACROS
  22. 22. • The Code Format Macro is a Dynamic Content Macro:! • the body can be of any size! • it integrates with a third party! • its hard to predict the render time or the size of the output Code Format Macro MACROS
  23. 23. Confluence Connect DESIGN SECURITY PERFORMANCE MACROS
  24. 24. Example • Consider a simple connect macro to include a status indicator on your page! • Status as a parameter, and no body. PERFORMANCE
  25. 25. Example PERFORMANCE http://bitbucket.org/mjensen/status-addon
  26. 26. Static Content Macros Confluence Add onBrowser status=Awesome Awesome Requested Returned PERFORMANCE Cached
  27. 27. • Design allows for aggressive cache settings! • You should set appropriate cache headers for your all your resources Caching res.setHeader(! !! ! 'Cache-Control',! !! ! ['private','max-age=3600']! ); routes/index.js PERFORMANCE
  28. 28. • A versioned URL allows you to control when your cached content is refreshed Versioned URLs app.get('/v1/my-macro',! function (req, res) { … }! ) routes/index.js PERFORMANCE
  29. 29. • The macro body can be passed as a parameter! • This can allow you to use caching on your resources, even when the body is needed Body as a Parameter "staticContentMacros": [{! "url": "/macro?body={macro.body}", ! …! }] atlassian-connect.json PERFORMANCE
  30. 30. Body as a Parameter Confluence Add onBrowser Rendered Requested Returned body=Awesome PERFORMANCE Cached
  31. 31. • Body is limited to 128 characters! • May appear in Confluence logs! • May be tracked in caches or proxies Body as a Parameter PERFORMANCE
  32. 32. • Some integrations happen synchronously! • Remote Conditions and Static Content Macros Synchronous Callbacks Confluence Add onBrowser Request Slow Response !#$ PERFORMANCE
  33. 33. Confluence Connect DESIGN SECURITY PERFORMANCE MACROS
  34. 34. Do you need to store any data at all? Data Storage SECURITY
  35. 35. Web Security Vulnerable area Permitted to user Permitted to add on SECURITY READADMIN
  36. 36. • Use JWT for simple integration with Confluence REST api! • Define your scopes to be as restrictive as possible Web Security {! "key": "my-addon",! "scopes": [ "read" ],! "authentication": { "type": "jwt" },! …! } atlassian-connect.json SECURITY
  37. 37. Confluence Connect DESIGN SECURITY PERFORMANCE MACROS
  38. 38. • Static add ons contain only html and javascript files Static Add Ons Confluence Add onBrowser DESIGN
  39. 39. Coming Up
  40. 40. Blueprints COMING UP
  41. 41. Blueprints "blueprints": [{! "key": "hello-world-blueprint",! "name": { "value": "Hello World Blueprint" },! "template": {! "url": “/blueprints/hello-world.xml”! },! "icon": { "url": "/blueprints/hello-world.png" }! }] atlassian-connect.json COMING UP
  42. 42. Blueprints <table><tbody>! <tr><th>Name</th><th>Date</th></tr>! <tr>! <td>! <ac:placeholder>Enter today's date here</ac:placeholder>! </td>! <td>! <at:var at:name="user"/>! </td>! </tr>! </tbody></table> atlassian-connect.json COMING UP
  43. 43. Blueprints COMING UP
  44. 44. Blueprints COMING UP
  45. 45. Blueprints https://bitbucket.org/mjensen/hello-blueprint-connect https://ecosystem.atlassian.net/browse/AC-1082 Example Plugin Blueprints Ongoing Work Help us set the direction! COMING UP
  46. 46. CQL COMING UP
  47. 47. We need you! Yes you! COMING UP
  48. 48. Questions? @matthewjensen mjensen@atlassian.com

×