keycloak-hs 1.0.0 → 1.0.1
raw patch · 3 files changed
+62/−55 lines, 3 filesdep ~aesondep ~aeson-casingdep ~base
Dependency ranges changed: aeson, aeson-casing, base, base64-bytestring, bytestring, containers, exceptions, hslogger, http-api-data, http-client, http-types, jwt, lens, mtl, safe, string-conversions, text, word8, wreq
Files
- keycloak-hs.cabal +50/−50
- src/Keycloak/Client.hs +1/−1
- src/Keycloak/Types.hs +11/−4
keycloak-hs.cabal view
@@ -1,59 +1,59 @@-name: keycloak-hs-version: 1.0.0-description: Please see the README on GitHub at <https://github.com/cdupont/keycloak-hs#readme>-homepage: https://github.com/cdupont/keycloak-hs#readme-bug-reports: https://github.com/cdupont/keycloak-hs/issues-author: Corentin Dupont-maintainer: corentin.dupont@gmail.com-copyright: 2019 Corentin Dupont-license: BSD3-license-file: LICENSE-build-type: Simple-cabal-version: 1.12+cabal-version: 1.12+name: keycloak-hs+version: 1.0.1+license: BSD3+license-file: LICENSE+copyright: 2019 Corentin Dupont+maintainer: corentin.dupont@gmail.com+author: Corentin Dupont+homepage: https://github.com/cdupont/keycloak-hs#readme+bug-reports: https://github.com/cdupont/keycloak-hs/issues+description:+ Please see the README on GitHub at <https://github.com/cdupont/keycloak-hs#readme>+build-type: Simple extra-source-files: README.md ChangeLog.md source-repository head- type: git- location: https://github.com/cdupont/keycloak-hs+ type: git+ location: https://github.com/cdupont/keycloak-hs library- exposed-modules:+ exposed-modules: Keycloak.Client- , Keycloak.Types- , Keycloak- other-modules:- Paths_keycloak_hs- hs-source-dirs:- src- build-depends:- base >=4.7 && <5- , http-client- , lens- , mtl- , word8- , bytestring- , text- , aeson- , aeson-casing- , http-api-data- , http-types- , hslogger- , string-conversions- , wreq- , base64-bytestring- , exceptions- , jwt- , containers- , safe- default-language: Haskell2010--Executable example- hs-source-dirs: examples- Main-Is: Main.hs- ghc-options: -threaded -Wall- build-depends: base- , keycloak-hs- default-language: Haskell2010+ Keycloak.Types+ Keycloak+ hs-source-dirs: src+ other-modules:+ Paths_keycloak_hs+ default-language: Haskell2010+ build-depends:+ aeson >=1.4 && <1.5,+ aeson-casing >=0.1 && <0.3,+ base >=4.7 && <5,+ base64-bytestring >=1.0 && <1.1,+ containers >=0.5.9 && <0.7,+ bytestring >=0.10 && <0.11,+ exceptions >=0.10 && <0.11,+ http-api-data >=0.4 && <0.5,+ http-types >=0.12 && <0.13,+ http-client >=0.5 && <0.7,+ hslogger >=1.2 && <1.4,+ jwt ==0.10.*,+ lens >=4.17 && <4.19,+ mtl >=2.2 && <2.3,+ string-conversions >=0.4 && <0.5,+ safe >=0.3 && <0.4,+ text >=1.2 && <1.3,+ wreq >=0.5 && <0.6,+ word8 >=0.1 && <0.2 +executable example+ main-is: Main.hs+ hs-source-dirs: examples+ default-language: Haskell2010+ ghc-options: -threaded -Wall+ build-depends:+ base >=4.9.1.0 && <5,+ keycloak-hs -any
src/Keycloak/Client.hs view
@@ -188,7 +188,7 @@ -- | Update a resource updateResource :: Resource -> Token -> Keycloak ResourceId-updateResource r tok = createResource r tok+updateResource = createResource -- * Users
src/Keycloak/Types.hs view
@@ -115,10 +115,10 @@ -- | Token reply from Keycloak data TokenRep = TokenRep {- accessToken :: JWT.JSON,+ accessToken :: Text, expiresIn :: Int, refreshExpriresIn :: Int,- refreshToken :: JWT.JSON,+ refreshToken :: Text, tokenType :: Text, notBeforePolicy :: Int, sessionState :: Text,@@ -137,7 +137,7 @@ -- * Permissions -- | Scope name-newtype ScopeName = ScopeName {unScopeName :: Text} deriving (Show, Eq, Generic, Ord)+newtype ScopeName = ScopeName {unScopeName :: Text} deriving (Eq, Generic, Ord) --JSON instances instance ToJSON ScopeName where@@ -146,6 +146,9 @@ instance FromJSON ScopeName where parseJSON = genericParseJSON (defaultOptions {unwrapUnaryRecords = True}) +instance Show ScopeName where+ show (ScopeName s) = convertString s+ -- | Scope Id newtype ScopeId = ScopeId {unScopeId :: Text} deriving (Show, Eq, Generic) @@ -185,7 +188,11 @@ data PermReq = PermReq { permReqResourceId :: Maybe ResourceId, -- Requested ressource Ids. Nothing means "All resources". permReqScopes :: [ScopeName] -- Scopes requested. [] means "all scopes".- } deriving (Generic, Show, Eq, Ord)+ } deriving (Generic, Eq, Ord)++instance Show PermReq where+ show (PermReq (Just (ResourceId res1)) scopes) = (show res1) <> " " <> (show scopes)+ show (PermReq Nothing scopes) = "none " <> (show scopes)