Safe Haskell | None |
---|---|
Language | Haskell2010 |
SCIM user representation.
Our interpretation of the spec
The spec can be read at https://tools.ietf.org/html/rfc7643#section-4.1. While implementing the spec we had to resolve some ambiguities and place some additional constraints on the possible SCIM server behavior we can support.
Resource ID / user ID
The User
object doesn't contain a user ID (as in "opaque server-assigned
immutable ID") by design. IDs and metadata are added to types in a uniform
fashion by using WithId
and WithMeta
.
Optional fields
The spec only mandates the userName
and id
attribute. All other
attributes seem optional.
Multi-valued fields
When a multi-valued field (e.g. emails
) doesn't contain any values, it's
unclear whether we should serialize it as []
or omit it entirely. We have
opted for the latter to conform to an example in the spec:
https://tools.ietf.org/html/rfc7644#section-3.5.1.
TODO(arianvp):
Multi-valued attributes actually have some more quirky semantics that we
currently don't support yet. E.g. if the multi-values have a
primary
field then only one of the entires must have 'primary: true'
and all the others are either implied 'primary: false' or must be checked
that they're false
Attribute names
When parsing JSON objects, we ignore capitalization differences in field
names -- e.g. both USERNAME
and userName
are accepted.
This is described by the spec https://tools.ietf.org/html/rfc7643#section-2.1
Synopsis
- data User tag = User {
- schemas :: [Schema]
- userName :: Text
- externalId :: Maybe Text
- name :: Maybe Name
- displayName :: Maybe Text
- nickName :: Maybe Text
- profileUrl :: Maybe URI
- title :: Maybe Text
- userType :: Maybe Text
- preferredLanguage :: Maybe Text
- locale :: Maybe Text
- active :: Maybe ScimBool
- password :: Maybe Text
- emails :: [Email]
- phoneNumbers :: [Phone]
- ims :: [IM]
- photos :: [Photo]
- addresses :: [Address]
- entitlements :: [Text]
- roles :: [Text]
- x509Certificates :: [Certificate]
- extra :: UserExtra tag
- empty :: [Schema] -> Text -> UserExtra tag -> User tag
- data NoUserExtra = NoUserExtra
- applyPatch :: (Patchable (UserExtra tag), FromJSON (UserExtra tag), MonadError ScimError m, UserTypes tag) => User tag -> PatchOp tag -> m (User tag)
- resultToScimError :: MonadError ScimError m => Result a -> m a
- isUserSchema :: Maybe Schema -> Bool
- module Web.Scim.Schema.UserTypes
Documentation
SCIM user record, parametrized with type-level tag t
(see UserTypes
).
User | |
|
Instances
data NoUserExtra Source #
A type used to indicate that the SCIM record doesn't have any extra data. Encoded as an empty map.
Instances
Eq NoUserExtra Source # | |
Defined in Web.Scim.Schema.User (==) :: NoUserExtra -> NoUserExtra -> Bool # (/=) :: NoUserExtra -> NoUserExtra -> Bool # | |
Show NoUserExtra Source # | |
Defined in Web.Scim.Schema.User showsPrec :: Int -> NoUserExtra -> ShowS # show :: NoUserExtra -> String # showList :: [NoUserExtra] -> ShowS # | |
ToJSON NoUserExtra Source # | |
Defined in Web.Scim.Schema.User toJSON :: NoUserExtra -> Value # toEncoding :: NoUserExtra -> Encoding # toJSONList :: [NoUserExtra] -> Value # toEncodingList :: [NoUserExtra] -> Encoding # | |
FromJSON NoUserExtra Source # | |
Defined in Web.Scim.Schema.User parseJSON :: Value -> Parser NoUserExtra # parseJSONList :: Value -> Parser [NoUserExtra] # | |
Patchable NoUserExtra Source # | |
Defined in Web.Scim.Schema.User applyOperation :: MonadError ScimError m => NoUserExtra -> Operation -> m NoUserExtra Source # |
applyPatch :: (Patchable (UserExtra tag), FromJSON (UserExtra tag), MonadError ScimError m, UserTypes tag) => User tag -> PatchOp tag -> m (User tag) Source #
Applies a JSON Patch to a SCIM Core User Only supports the core attributes. Evenmore, only some hand-picked ones currently. We'll have to think how patch is going to work in the presence of extensions. Also, we can probably make PatchOp type-safe to some extent (Read arianvp's thesis :))
resultToScimError :: MonadError ScimError m => Result a -> m a Source #
module Web.Scim.Schema.UserTypes