Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code with ormolu #59

Merged
merged 7 commits into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
.PHONY: test
test:
export SAML2_WEB_SSO_ROOT=$$(pwd) && stack build --test

# formats all Haskell files (which don't contain CPP)
.PHONY: format
format:
./tools/ormolu.sh
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,8 @@ This should start the `toy-sp` app. Now you can connect to

`<your-idp>` has to be the path value of one of the IdPs registered in
`server.yaml`.

# Contributing

Make sure to run `make format` before submitting a PR.
This will use [ormolu](https://github.com/tweag/ormolu) to format the code.
32 changes: 18 additions & 14 deletions src/SAML2/Util.hs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{-# LANGUAGE OverloadedStrings #-}

module SAML2.Util (module SAML2.Util, module Text.XML.Util)
module SAML2.Util
( module SAML2.Util,
module Text.XML.Util,
)
where

import Control.Lens
import Control.Monad.Except
import Data.String.Conversions
import qualified Data.Text as ST
import Data.Typeable
import GHC.Stack
import Text.XML.Util
import URI.ByteString

import qualified Data.Text as ST


renderURI :: URI -> ST
renderURI = cs . serializeURIRef'

Expand All @@ -38,13 +39,16 @@ oldpath -/ pathext = uriUnSegments . uriSegments $ oldpath <> "/" <> pathext
uri =/ pathext = normURI $ uri & pathL %~ (<> "/" <> cs pathext)

normURI :: URI -> URI
normURI = unsafeParseURI . cs . normalizeURIRef' URINormalizationOptions
{ unoDowncaseScheme = True
, unoDowncaseHost = True
, unoDropDefPort = False
, unoSlashEmptyPath = True
, unoDropExtraSlashes = True
, unoSortParameters = True
, unoRemoveDotSegments = True
, unoDefaultPorts = mempty
}
normURI =
unsafeParseURI . cs
. normalizeURIRef'
URINormalizationOptions
{ unoDowncaseScheme = True,
unoDowncaseHost = True,
unoDropDefPort = False,
unoSlashEmptyPath = True,
unoDropExtraSlashes = True,
unoSortParameters = True,
unoRemoveDotSegments = True,
unoDefaultPorts = mempty
}
35 changes: 18 additions & 17 deletions src/SAML2/WebSSO.hs
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
{- |

Relevant parts of the standard are referenced throughout the code, using the notation
@[<file>/<paragraph>]@. <file> is one of these:

[1] http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf
[2] http://docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf
[3] http://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf
[4] http://docs.oasis-open.org/security/saml/v2.0/saml-metadata-2.0-os.pdf
[5] http://docs.oasis-open.org/security/saml/v2.0/saml-authn-context-2.0-os.pdf
[6] http://docs.oasis-open.org/security/saml/v2.0/saml-conformance-2.0-os.pdf
[7] http://docs.oasis-open.org/security/saml/v2.0/saml-sec-consider-2.0-os.pdf
[8] http://docs.oasis-open.org/security/saml/v2.0/saml-glossary-2.0-os.pdf

-}
module SAML2.WebSSO (module X) where
-- |
--
-- Relevant parts of the standard are referenced throughout the code, using the notation
-- @[<file>/<paragraph>]@. <file> is one of these:
--
-- [1] http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf
-- [2] http://docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf
-- [3] http://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf
-- [4] http://docs.oasis-open.org/security/saml/v2.0/saml-metadata-2.0-os.pdf
-- [5] http://docs.oasis-open.org/security/saml/v2.0/saml-authn-context-2.0-os.pdf
-- [6] http://docs.oasis-open.org/security/saml/v2.0/saml-conformance-2.0-os.pdf
-- [7] http://docs.oasis-open.org/security/saml/v2.0/saml-sec-consider-2.0-os.pdf
-- [8] http://docs.oasis-open.org/security/saml/v2.0/saml-glossary-2.0-os.pdf
module SAML2.WebSSO
( module X,
)
where

import SAML2.Util as X
import SAML2.WebSSO.API as X
import SAML2.WebSSO.Config as X
import SAML2.WebSSO.Cookie as X
import SAML2.WebSSO.Error as X
import SAML2.WebSSO.SP as X
import SAML2.WebSSO.Types as X
import SAML2.WebSSO.XML as X
import SAML2.WebSSO.Cookie as X
Loading