packages feed

atlassian-connect-core 0.1.0.0 → 0.2.0.0

raw patch · 6 files changed

+6/−24 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Snap.AtlassianConnect: connectPluginKey :: Connect -> PluginKey
- Snap.AtlassianConnect: connectPluginName :: Connect -> Name Connect
- Snap.AtlassianConnect: Connect :: AES -> Timeout -> Plugin -> Name Connect -> PluginKey -> URI -> [HostName] -> Connect
+ Snap.AtlassianConnect: Connect :: AES -> Timeout -> Plugin -> URI -> [HostName] -> Connect

Files

atlassian-connect-core.cabal view
@@ -10,7 +10,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.1.0.0+version:             0.2.0.0  -- A short (one-line) description of the package. synopsis:            Atlassian Connect snaplet for the Snap Framework and helper code.
resources/connect.cfg view
@@ -1,6 +1,4 @@ # Plugin Details-plugin_name = "My Atlassian Addon"-plugin_key = "com.myorgname.myaddonname" base_url = "http://localhost:8080"  # Secret Key - Currently only used for page tokens. Please keep secure.
src/Snap/AtlassianConnect/Connect.hs view
@@ -53,8 +53,6 @@  data ConnectConfig = ConnectConfig   { ccSecretKey        :: BSC.ByteString-  , ccPluginName       :: Text-  , ccPluginKey        :: Text   , ccBaseUrl          :: NU.URI   , ccPageTokenTimeout :: TU.ConnectSecond   , ccHostWhiteList    :: [Text]   -- TODO This host whitelist should be loaded from configuration@@ -64,8 +62,6 @@ toConnect plugin conf = Connect   { connectPlugin = plugin   , connectAES = CCA.initAES $ ccSecretKey conf-  , connectPluginName = D.Name $ ccPluginName conf-  , connectPluginKey = D.PluginKey $ ccPluginKey conf   , connectBaseUrl = ccBaseUrl conf   , connectPageTokenTimeout = D.Timeout . TU.getSecond . ccPageTokenTimeout $ conf   , connectHostWhitelist = ccHostWhiteList conf@@ -73,8 +69,6 @@  loadConnectConfig :: DCT.Config -> IO ConnectConfig loadConnectConfig connectConf = do-  name <- require connectConf "plugin_name" "Missing plugin name in connect configuration file."-  key <- require connectConf "plugin_key" "Missing plugin key in connect configuration file."   rawBaseUrl <- require connectConf "base_url" "Missing base url in connect configuration file."   secret <- require connectConf "secret_key" "Missing secret key in connect configuration file."   hostWhiteList <- validHosts@@ -88,9 +82,7 @@     Just baseUrl -> do       pageTokenTimeoutInSeconds <- DC.lookupDefault PT.defaultTimeoutSeconds connectConf "page_token_timeout_seconds"       return ConnectConfig-        { ccPluginName = name-        , ccPluginKey = key-        , ccBaseUrl = baseUrl+        { ccBaseUrl = baseUrl         , ccSecretKey = maybe secret BSC.pack envSecretKey         , ccPageTokenTimeout = pageTokenTimeoutInSeconds         , ccHostWhiteList = hostWhiteList
src/Snap/AtlassianConnect/Data.hs view
@@ -18,8 +18,6 @@   { connectAES              :: CCA.AES      -- ^ The AES key that will be used for Page Token support.   , connectPageTokenTimeout :: Timeout      -- ^ The Page Token Timeout (how long the token is valid for).   , connectPlugin           :: Plugin       -- ^ The Atlassian Connect Descriptor for your Add-on.-  , connectPluginName       :: Name Connect -- ^ The Name of your Atlassian Connect Add-on loaded from configuration.-  , connectPluginKey        :: PluginKey    -- ^ The Key of your Atlassian Connect Add-on loaded from configuration.   , connectBaseUrl          :: NU.URI       -- ^ The URL that your Add-on will report as it's base URL. Especially useful if you are behind a load balancer.   , connectHostWhitelist    :: [HostName]   -- ^ The suffixes in the hostname that should be allowed to be installed as Connect Add-ons.   }@@ -33,7 +31,5 @@   getConnect :: m Connect  data DynamicDescriptorConfig = DynamicDescriptorConfig-  { dcPluginName :: Name Plugin-  , dcPluginKey  :: PluginKey-  , dcBaseUrl    :: NU.URI+  { dcBaseUrl :: NU.URI   }
src/Snap/AtlassianConnect/HostRequest.hs view
@@ -100,7 +100,7 @@ hostRequest :: FromJSON a => StdMethod -> AC.Tenant -> B.ByteString -> [(B.ByteString, Maybe B.ByteString)] -> Endo Request -> SS.Handler b AC.Connect (Either ProductErrorResponse a) hostRequest standardHttpMethod tenant productRelativeUrl queryParams requestModifications = do     currentTime <- MI.liftIO P.getPOSIXTime-    pluginKey <- fmap AC.connectPluginKey get+    pluginKey <- fmap (CD.pluginKey . AC.connectPlugin) get     case generateJWTToken pluginKey currentTime (AC.sharedSecret tenant) standardHttpMethod productBaseUrl url of         Nothing -> return . Left $ ProductErrorResponse 500 "Failed to generate a JWT token to make the request. The request was never made: server error."         (Just signature) -> MI.liftIO $ runRequest defaultManagerSettings standardHttpMethod url
src/Snap/AtlassianConnect/Routes.hs view
@@ -86,14 +86,10 @@  genDescriptorExtrasFromConnect :: CD.Connect -> CD.DynamicDescriptorConfig genDescriptorExtrasFromConnect connectData = CD.DynamicDescriptorConfig-    { CD.dcPluginName = case CD.connectPluginName connectData of D.Name t -> D.Name t-    , CD.dcPluginKey = CD.connectPluginKey connectData-    , CD.dcBaseUrl = CD.connectBaseUrl connectData+    { CD.dcBaseUrl = CD.connectBaseUrl connectData     }  convertPluginDescriptor :: CD.DynamicDescriptorConfig -> D.Plugin -> D.Plugin convertPluginDescriptor dc plugin = plugin-    { D.pluginKey = CD.dcPluginKey dc-    , D.pluginName = Just . CD.dcPluginName $ dc-    , D.pluginBaseUrl = CD.dcBaseUrl dc+    { D.pluginBaseUrl = CD.dcBaseUrl dc     }