3
3
[ ![ GoVersion] ( https://img.shields.io/github/go-mod/go-version/elimity-com/scim.svg )] ( https://github.com/elimity-com/scim )
4
4
[ ![ GoDoc] ( https://img.shields.io/badge/godoc-reference-blue.svg )] ( https://pkg.go.dev/github.com/elimity-com/scim )
5
5
6
-
7
6
[ ![ Tag] ( https://img.shields.io/github/tag/elimity-com/scim.svg )] ( https://gitHub.com/elimity-com/scim/releases )
8
7
9
- This is an open source implementation of the [ SCIM v2.0] ( http://www.simplecloud.info/#Specification ) specification for use in Golang.
8
+ This is an open source implementation of the [ SCIM v2.0] ( http://www.simplecloud.info/#Specification ) specification for
9
+ use in Golang.
10
10
SCIM defines a flexible schema mechanism and REST API for managing identity data.
11
- The goal is to reduce the complexity of user management operations by providing patterns for exchanging schemas using HTTP.
11
+ The goal is to reduce the complexity of user management operations by providing patterns for exchanging schemas using
12
+ HTTP.
12
13
13
14
In this implementation it is easy to add * custom* schemas and extensions with the provided structures.
14
15
Incoming resources will be * validated* by their corresponding schemas before being passed on to their callbacks.
15
16
16
17
The following features are supported:
18
+
17
19
- GET for ` /Schemas ` , ` /ServiceProviderConfig ` and ` /ResourceTypes `
18
20
- CRUD (POST/GET/PUT/DELETE and PATCH) for your own resource types (i.e. ` /Users ` , ` /Groups ` , ` /Employees ` , ...)
19
21
20
22
Other optional features such as sorting, bulk, etc. are ** not** supported in this version.
21
23
22
24
## Installation
25
+
23
26
Assuming you already have a (recent) version of Go installed, you can get the code with go get:
27
+
24
28
``` bash
25
29
$ go get github.com/elimity-com/scim
26
30
```
27
31
28
32
## Usage
33
+
29
34
** !** errors are ignored for simplicity.
35
+
30
36
### 1. Create a service provider configuration.
37
+
31
38
[ RFC Config] ( https://tools.ietf.org/html/rfc7643#section-5 ) |
32
39
[ Example Config] ( https://tools.ietf.org/html/rfc7643#section-8.5 )
40
+
33
41
``` go
34
42
config := scim.ServiceProviderConfig {
35
43
DocumentationURI : optional.NewString (" www.example.com/scim" ),
36
44
}
37
45
```
46
+
38
47
** !** no additional features/operations are supported in this version.
39
48
40
49
### 2. Create all supported schemas and extensions.
50
+
41
51
[ RFC Schema] ( https://tools.ietf.org/html/rfc7643#section-2 ) |
42
52
[ User Schema] ( https://tools.ietf.org/html/rfc7643#section-4.1 ) |
43
53
[ Group Schema] ( https://tools.ietf.org/html/rfc7643#section-4.2 ) |
44
54
[ Extension Schema] ( https://tools.ietf.org/html/rfc7643#section-4.3 )
55
+
45
56
``` go
46
57
schema := schema.Schema {
47
58
ID : " urn:ietf:params:scim:schemas:core:2.0:User" ,
@@ -72,18 +83,23 @@ extension := schema.Schema{
72
83
```
73
84
74
85
### 3. Create all resource types and their callbacks.
86
+
75
87
[ RFC Resource Type] ( https://tools.ietf.org/html/rfc7643#section-6 ) |
76
88
[ Example Resource Type] ( https://tools.ietf.org/html/rfc7643#section-8.6 )
77
89
78
90
#### 3.1 Callback (implementation of ` ResourceHandler ` )
91
+
79
92
[ Simple In Memory Example] ( resource_handler_test.go )
93
+
80
94
``` go
81
95
var userResourceHandler scim.ResourceHandler
82
96
// initialize w/ own implementation
83
97
```
98
+
84
99
** !** each resource type should have its own resource handler.
85
100
86
101
#### 3.2 Resource Type
102
+
87
103
``` go
88
104
resourceTypes := []ResourceType {
89
105
{
@@ -101,44 +117,79 @@ resourceTypes := []ResourceType{
101
117
```
102
118
103
119
### 4. Create Server
120
+
104
121
``` go
105
- server := Server {
106
- Config : config,
122
+ serverArgs := &ServerArgs {
123
+ ServiceProviderConfig : config,
107
124
ResourceTypes : resourceTypes,
108
125
}
126
+
127
+ serverOpts := []ServerOption {
128
+ WithLogger (logger), // optional, default is no logging
129
+ }
130
+
131
+ server , err := NewServer (serverArgs, serverOpts...)
132
+ ```
133
+
134
+ ## Backwards Compatibility
135
+
136
+ Even though the SCIM package has been running in some production environments, it is still in an early stage, and not
137
+ all features are supported. So be aware that a change in the minor version could break your implementation. We will not
138
+ make any breaking changes that takes hours to fix, but some functions might change name or signature.
139
+
140
+ This was the case for ` v0.1 ` to ` v0.2.0 ` .
141
+
142
+ ## String Values for Attributes
143
+
144
+ By default, the SCIM server will NOT use the ` string ` type for all attributes, since this is NOT compliant with the
145
+ SCIM specification. It is still possible to enable this behavior by toggling a flag within the ` schema ` package.
146
+
147
+ ``` go
148
+ import " github.com/elimity-com/scim/schema"
149
+
150
+ schema.SetAllowStringValues (true )
109
151
```
110
152
111
153
## Addition Checks/Tests
154
+
112
155
Not everything can be checked by the SCIM server itself.
113
156
Below are some things listed that we expect that the implementation covers.
114
157
115
158
** !** this list is currently incomplete!
116
159
117
- We want to keep this list as short as possible.
160
+ We want to keep this list as short as possible.
118
161
If you have ideas how we could enforce these rules in the server itself do not hesitate to open
119
162
[ an issue] ( https://github.com/elimity-com/scim/issues/new ) or a PR.
163
+
120
164
### Mutability
165
+
121
166
#### Immutable Attributes
167
+
122
168
* PUT Handler* : If one or more values are already set for the attribute, the input value(s) MUST match.
169
+
123
170
#### WriteOnly Attributes
171
+
124
172
* ALL Handlers* : Attribute values SHALL NOT be returned. \
125
173
Note: These attributes usually also has a returned setting of "never".
126
174
127
175
## Contributing
176
+
128
177
[ ![ Contributors] ( https://img.shields.io/github/contributors/elimity-com/scim.svg )] ( https://gitHub.com/elimity-com/scim/contributors/ )
129
178
130
179
We are happy to review pull requests,
131
180
but please first discuss the change you wish to make via issue, email,
132
181
or any other method with the owners of this repository before making a change.
133
182
134
183
If you would like to propose a change please ensure the following:
135
- - All checks of GitHub Actions are passing ([ GolangCI-Lint] ( https://github.com/golangci/golangci-lint ) : ` misspell ` , ` godot ` and ` whitespace ` )
184
+
185
+ - All checks of GitHub Actions are
186
+ passing ([ GolangCI-Lint] ( https://github.com/golangci/golangci-lint ) : ` misspell ` , ` godot ` and ` whitespace ` )
136
187
- All already existing tests are passing.
137
188
- You have written tests that cover the code you are making, make sure to include edge cases.
138
189
- There is documentation for at least all public functions you have added.
139
190
- New public functions and structures are kept to a minimum.
140
191
- The same practices are applied (such as the anatomy of methods, names, etc.)
141
192
- Your changes are compliant with SCIM v2.0 (released as
142
- [ RFC7642] ( https://tools.ietf.org/html/rfc7642 ) ,
143
- [ RFC7643] ( https://tools.ietf.org/html/rfc7643 ) and
144
- [ RFC7644] ( https://tools.ietf.org/html/rfc7644 ) under [ IETF] ( https://ietf.org/ ) ).
193
+ [ RFC7642] ( https://tools.ietf.org/html/rfc7642 ) ,
194
+ [ RFC7643] ( https://tools.ietf.org/html/rfc7643 ) and
195
+ [ RFC7644] ( https://tools.ietf.org/html/rfc7644 ) under [ IETF] ( https://ietf.org/ ) ).
0 commit comments