@@ -61,7 +61,6 @@ import Servant
61
61
import qualified Servant.Multipart as Multipart
62
62
import Spar.App
63
63
import Spar.CanonicalInterpreter
64
- import qualified Spar.Data as Data (GetIdPResult (.. ), Replaced (.. ), Replacing (.. ))
65
64
import Spar.Error
66
65
import qualified Spar.Intra.BrigApp as Brig
67
66
import Spar.Orphans ()
@@ -76,6 +75,7 @@ import Spar.Sem.DefaultSsoCode (DefaultSsoCode)
76
75
import qualified Spar.Sem.DefaultSsoCode as DefaultSsoCode
77
76
import Spar.Sem.GalleyAccess (GalleyAccess )
78
77
import qualified Spar.Sem.GalleyAccess as GalleyAccess
78
+ import Spar.Sem.IdP (GetIdPResult (.. ), Replaced (.. ), Replacing (.. ))
79
79
import qualified Spar.Sem.IdP as IdPEffect
80
80
import Spar.Sem.IdPRawMetadataStore (IdPRawMetadataStore )
81
81
import qualified Spar.Sem.IdPRawMetadataStore as IdPRawMetadataStore
@@ -494,11 +494,11 @@ idpDelete zusr idpid (fromMaybe False -> purge) = withDebugLog "idpDelete" (cons
494
494
updateReplacingIdP :: IdP -> Sem r ()
495
495
updateReplacingIdP idp = forM_ (idp ^. SAML. idpExtraInfo . wiOldIssuers) $ \ oldIssuer -> do
496
496
getIdPIdByIssuer oldIssuer (idp ^. SAML. idpExtraInfo . wiTeam) >>= \ case
497
- Data. GetIdPFound iid -> IdPEffect. clearReplacedBy $ Data. Replaced iid
498
- Data. GetIdPNotFound -> pure ()
499
- Data. GetIdPDanglingId _ -> pure ()
500
- Data. GetIdPNonUnique _ -> pure ()
501
- Data. GetIdPWrongTeam _ -> pure ()
497
+ GetIdPFound iid -> IdPEffect. clearReplacedBy $ Replaced iid
498
+ GetIdPNotFound -> pure ()
499
+ GetIdPDanglingId _ -> pure ()
500
+ GetIdPNonUnique _ -> pure ()
501
+ GetIdPWrongTeam _ -> pure ()
502
502
503
503
-- | This handler only does the json parsing, and leaves all authorization checks and
504
504
-- application logic to 'idpCreateXML'.
@@ -548,7 +548,7 @@ idpCreateXML zusr raw idpmeta mReplaces (fromMaybe defWireIdPAPIVersion -> apive
548
548
IdPRawMetadataStore. store (idp ^. SAML. idpId) raw
549
549
storeIdPConfig idp
550
550
forM_ mReplaces $ \ replaces -> do
551
- IdPEffect. setReplacedBy (Data. Replaced replaces) (Data. Replacing (idp ^. SAML. idpId))
551
+ IdPEffect. setReplacedBy (Replaced replaces) (Replacing (idp ^. SAML. idpId))
552
552
pure idp
553
553
554
554
-- | In teams with a scim access token, only one IdP is allowed. The reason is that scim user
@@ -636,11 +636,11 @@ validateNewIdP apiversion _idpMetadata teamId mReplaces = withDebugLog "validate
636
636
pure ()
637
637
638
638
case idp of
639
- Data. GetIdPFound idp' {- same team -} -> handleIdPClash (Right idp')
640
- Data. GetIdPNotFound -> pure ()
641
- res@ (Data. GetIdPDanglingId _) -> throwSparSem . SparIdPNotFound . (" validateNewIdP: " <> ) . cs . show $ res -- database inconsistency
642
- Data. GetIdPNonUnique ids' {- same team didn't yield anything, but there are at least two other teams with this issuer already -} -> handleIdPClash (Left ids')
643
- Data. GetIdPWrongTeam id' {- different team -} -> handleIdPClash (Left id')
639
+ GetIdPFound idp' {- same team -} -> handleIdPClash (Right idp')
640
+ GetIdPNotFound -> pure ()
641
+ res@ (GetIdPDanglingId _) -> throwSparSem . SparIdPNotFound . (" validateNewIdP: " <> ) . cs . show $ res -- database inconsistency
642
+ GetIdPNonUnique ids' {- same team didn't yield anything, but there are at least two other teams with this issuer already -} -> handleIdPClash (Left ids')
643
+ GetIdPWrongTeam id' {- different team -} -> handleIdPClash (Left id')
644
644
645
645
pure SAML. IdPConfig {.. }
646
646
@@ -726,11 +726,11 @@ validateIdPUpdate zusr _idpMetadata _idpId = withDebugLog "validateNewIdP" (Just
726
726
else do
727
727
foundConfig <- getIdPConfigByIssuerAllowOld newIssuer (Just teamId)
728
728
notInUseByOthers <- case foundConfig of
729
- Data. GetIdPFound c -> pure $ c ^. SAML. idpId == _idpId
730
- Data. GetIdPNotFound -> pure True
731
- res@ (Data. GetIdPDanglingId _) -> throwSparSem . SparIdPNotFound . (" validateIdPUpdate: " <> ) . cs . show $ res -- impossible
732
- res@ (Data. GetIdPNonUnique _) -> throwSparSem . SparIdPNotFound . (" validateIdPUpdate: " <> ) . cs . show $ res -- impossible (because team id was used in lookup)
733
- Data. GetIdPWrongTeam _ -> pure False
729
+ GetIdPFound c -> pure $ c ^. SAML. idpId == _idpId
730
+ GetIdPNotFound -> pure True
731
+ res@ (GetIdPDanglingId _) -> throwSparSem . SparIdPNotFound . (" validateIdPUpdate: " <> ) . cs . show $ res -- impossible
732
+ res@ (GetIdPNonUnique _) -> throwSparSem . SparIdPNotFound . (" validateIdPUpdate: " <> ) . cs . show $ res -- impossible (because team id was used in lookup)
733
+ GetIdPWrongTeam _ -> pure False
734
734
if notInUseByOthers
735
735
then pure $ (previousIdP ^. SAML. idpExtraInfo) & wiOldIssuers %~ nub . (previousIssuer : )
736
736
else throwSparSem SparIdPIssuerInUse
0 commit comments