scimServiceProviderConfig returns a static SCIM service provider configuration. @Summary SCIM 2.0: Service Provider Config @ID scim-get-service-provider-config @Produce application/scim+json @Tags Enterprise @Success 200 @Router /scim/v2/ServiceProviderConfig [get]
(rw http.ResponseWriter, _ *http.Request)
| 51 | // @Success 200 |
| 52 | // @Router /scim/v2/ServiceProviderConfig [get] |
| 53 | func (api *API) scimServiceProviderConfig(rw http.ResponseWriter, _ *http.Request) { |
| 54 | // No auth needed to query this endpoint. |
| 55 | |
| 56 | rw.Header().Set("Content-Type", spec.ApplicationScimJson) |
| 57 | rw.WriteHeader(http.StatusOK) |
| 58 | |
| 59 | // providerUpdated is the last time the static provider config was updated. |
| 60 | // Increment this time if you make any changes to the provider config. |
| 61 | providerUpdated := time.Date(2024, 10, 25, 17, 0, 0, 0, time.UTC) |
| 62 | var location string |
| 63 | locURL, err := api.AccessURL.Parse("/scim/v2/ServiceProviderConfig") |
| 64 | if err == nil { |
| 65 | location = locURL.String() |
| 66 | } |
| 67 | |
| 68 | enc := json.NewEncoder(rw) |
| 69 | enc.SetEscapeHTML(true) |
| 70 | _ = enc.Encode(scim.ServiceProviderConfig{ |
| 71 | Schemas: []string{"urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"}, |
| 72 | DocURI: "https://coder.com/docs/admin/users/oidc-auth#scim", |
| 73 | Patch: scim.Supported{ |
| 74 | Supported: true, |
| 75 | }, |
| 76 | Bulk: scim.BulkSupported{ |
| 77 | Supported: false, |
| 78 | }, |
| 79 | Filter: scim.FilterSupported{ |
| 80 | Supported: false, |
| 81 | }, |
| 82 | ChangePassword: scim.Supported{ |
| 83 | Supported: false, |
| 84 | }, |
| 85 | Sort: scim.Supported{ |
| 86 | Supported: false, |
| 87 | }, |
| 88 | ETag: scim.Supported{ |
| 89 | Supported: false, |
| 90 | }, |
| 91 | AuthSchemes: []scim.AuthenticationScheme{ |
| 92 | { |
| 93 | Type: "oauthbearertoken", |
| 94 | Name: "HTTP Header Authentication", |
| 95 | Description: "Authentication scheme using the Authorization header with the shared token", |
| 96 | DocURI: "https://coder.com/docs/admin/users/oidc-auth#scim", |
| 97 | }, |
| 98 | }, |
| 99 | Meta: scim.ServiceProviderMeta{ |
| 100 | Created: providerUpdated, |
| 101 | LastModified: providerUpdated, |
| 102 | Location: location, |
| 103 | ResourceType: "ServiceProviderConfig", |
| 104 | }, |
| 105 | }) |
| 106 | } |
| 107 | |
| 108 | // scimGetUsers intentionally always returns no users. This is done to always force |
| 109 | // Okta to try and create each user individually, this way we don't need to |