-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Various QOL changes. * Move filter package out of internal. * Expose filter validator. * feat: create server instance using constructor, use interface-based logger * fix: update server construction code * fix: correct resource type auto renaming * fix: correct resource type auto renaming * docs: correct the example in the docs * feat: change server constructor to accept mandatory arguments * Arrange code + tidy. * Fix typo. * Fix merge conflict. * Add note about backwards compatibility. * Fix typo README. --------- Co-authored-by: Dmitrii Prisacari <[email protected]>
- Loading branch information
Showing
49 changed files
with
981 additions
and
543 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.PHONY: all arrange tidy lint test | ||
|
||
all: arrange tidy lint test | ||
|
||
arrange: | ||
@echo "Arranging files..." | ||
@go fmt ./... | ||
@goarrange run -r | ||
|
||
tidy: | ||
@echo "Tidying up..." | ||
@go mod tidy | ||
|
||
lint: | ||
@echo "Linting files..." | ||
@go vet ./... | ||
@golangci-lint run ./... -E misspell,godot,whitespace | ||
|
||
test: | ||
@echo "Running tests..." | ||
@go test ./... -cover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,53 @@ | ||
package scim | ||
|
||
import ( | ||
"log" | ||
logger "log" | ||
"net/http" | ||
) | ||
|
||
func ExampleNewServer() { | ||
log.Fatal(http.ListenAndServe(":7643", Server{ | ||
Config: ServiceProviderConfig{}, | ||
ResourceTypes: nil, | ||
})) | ||
args := &ServerArgs{ | ||
ServiceProviderConfig: &ServiceProviderConfig{}, | ||
ResourceTypes: []ResourceType{}, | ||
} | ||
server, err := NewServer(args) | ||
if err != nil { | ||
logger.Fatal(err) | ||
} | ||
logger.Fatal(http.ListenAndServe(":7643", server)) | ||
} | ||
|
||
func ExampleNewServer_basePath() { | ||
http.Handle("/scim/", http.StripPrefix("/scim", Server{ | ||
Config: ServiceProviderConfig{}, | ||
ResourceTypes: nil, | ||
})) | ||
log.Fatal(http.ListenAndServe(":7643", nil)) | ||
args := &ServerArgs{ | ||
ServiceProviderConfig: &ServiceProviderConfig{}, | ||
ResourceTypes: []ResourceType{}, | ||
} | ||
server, err := NewServer(args) | ||
if err != nil { | ||
logger.Fatal(err) | ||
} | ||
// You can host the SCIM server on a custom path, make sure to strip the prefix, so only `/v2/` is left. | ||
http.Handle("/scim/", http.StripPrefix("/scim", server)) | ||
logger.Fatal(http.ListenAndServe(":7643", nil)) | ||
} | ||
|
||
func ExampleNewServer_logger() { | ||
loggingMiddleware := func(next http.Handler) http.Handler { | ||
fn := func(w http.ResponseWriter, r *http.Request) { | ||
logger.Println(r.Method, r.URL.Path) | ||
|
||
next.ServeHTTP(w, r) | ||
} | ||
|
||
return http.HandlerFunc(fn) | ||
} | ||
args := &ServerArgs{ | ||
ServiceProviderConfig: &ServiceProviderConfig{}, | ||
ResourceTypes: []ResourceType{}, | ||
} | ||
server, err := NewServer(args) | ||
if err != nil { | ||
logger.Fatal(err) | ||
} | ||
logger.Fatal(http.ListenAndServe(":7643", loggingMiddleware(server))) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.