refactor: Encapsulate aud config
This change is an initial step to change JWT aud configuration to regular expression. Exporting function audMatchesCfg :: AppConfig -> Text -> Bool from Config module allows changing the way how JWT aud is configured to be isolated and not affect code in Auth.JWT
This commit is contained in:
committed by
Laurence Isla
parent
0f7ac1bc39
commit
5a4e2e4dec
@@ -28,6 +28,7 @@ module PostgREST.Config
|
||||
, addFallbackAppName
|
||||
, addTargetSessionAttrs
|
||||
, exampleConfigFile
|
||||
, audMatchesCfg
|
||||
) where
|
||||
|
||||
import qualified Data.Aeson as JSON
|
||||
@@ -67,6 +68,8 @@ import PostgREST.SchemaCache.Identifiers (QualifiedIdentifier, dumpQi,
|
||||
|
||||
import Protolude hiding (Proxy, toList)
|
||||
|
||||
audMatchesCfg :: AppConfig -> Text -> Bool
|
||||
audMatchesCfg = maybe (const True) (==) . configJwtAudience
|
||||
|
||||
data AppConfig = AppConfig
|
||||
{ configAppSettings :: [(Text, Text)]
|
||||
|
||||
Reference in New Issue
Block a user