Skip to content

Commit c37759a

Browse files
committed
Update README.md
1 parent 97f851e commit c37759a

File tree

1 file changed

+17
-301
lines changed

1 file changed

+17
-301
lines changed

README.md

Lines changed: 17 additions & 301 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[![DockerHub latest version](https://img.shields.io/docker/v/xdevsoftware/oidc-server-mock?sort=semver&logo=docker&label=DockerHub)](https://hub.docker.com/r/xdevsoftware/oidc-server-mock)
2+
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/oidc-server-mock/check-build.yml?branch=develop)](https://github.com/xdev-software/oidc-server-mock/actions/workflows/check-build.yml?query=branch%3Adevelop)
3+
14
# OpenId Connect Server Mock - XDEV Edition
25

36
> [!NOTE]
@@ -9,308 +12,21 @@ This project allows you to run configurable mock server with OpenId Connect func
912
> Free for development, testing and personal projects.<br/>
1013
> For production you need to purchase [Duende IdentityServer license](https://duendesoftware.com/products/identityserver).
1114
12-
## Simple Configuration
13-
14-
Use the following to pull the image:
15-
16-
```bash
17-
docker pull xdevsoftware/oidc-server-mock:latest
18-
```
19-
20-
This is the sample of using the server in `docker-compose` configuration:
21-
22-
```yaml
23-
version: '3'
24-
services:
25-
oidc-server-mock:
26-
container_name: oidc-server-mock
27-
image: xdevsoftware/oidc-server-mock:latest
28-
ports:
29-
- '4011:80'
30-
environment:
31-
ASPNETCORE_ENVIRONMENT: Development
32-
SERVER_OPTIONS_INLINE: |
33-
{
34-
"AccessTokenJwtType": "JWT",
35-
"Discovery": {
36-
"ShowKeySet": true
37-
},
38-
"Authentication": {
39-
"CookieSameSiteMode": "Lax",
40-
"CheckSessionCookieSameSiteMode": "Lax"
41-
}
42-
}
43-
LOGIN_OPTIONS_INLINE: |
44-
{
45-
"AllowRememberLogin": false
46-
}
47-
LOGOUT_OPTIONS_INLINE: |
48-
{
49-
"AutomaticRedirectAfterSignOut": true
50-
}
51-
API_SCOPES_INLINE: |
52-
- Name: some-app-scope-1
53-
- Name: some-app-scope-2
54-
API_RESOURCES_INLINE: |
55-
- Name: some-app
56-
Scopes:
57-
- some-app-scope-1
58-
- some-app-scope-2
59-
USERS_CONFIGURATION_INLINE: |
60-
[
61-
{
62-
"SubjectId":"1",
63-
"Username":"User1",
64-
"Password":"pwd",
65-
"Claims": [
66-
{
67-
"Type": "name",
68-
"Value": "Sam Tailor",
69-
"ValueType": "string"
70-
},
71-
{
72-
"Type": "email",
73-
"Value": "[email protected]",
74-
"ValueType": "string"
75-
},
76-
{
77-
"Type": "some-api-resource-claim",
78-
"Value": "Sam's Api Resource Custom Claim",
79-
"ValueType": "string"
80-
},
81-
{
82-
"Type": "some-api-scope-claim",
83-
"Value": "Sam's Api Scope Custom Claim",
84-
"ValueType": "string"
85-
},
86-
{
87-
"Type": "some-identity-resource-claim",
88-
"Value": "Sam's Identity Resource Custom Claim",
89-
"ValueType": "string"
90-
}
91-
]
92-
}
93-
]
94-
CLIENTS_CONFIGURATION_PATH: /tmp/config/clients-config.json
95-
ASPNET_SERVICES_OPTIONS_INLINE: |
96-
{
97-
"ForwardedHeadersOptions": {
98-
"ForwardedHeaders" : "All"
99-
}
100-
}
101-
volumes:
102-
- .:/tmp/config:ro
103-
```
104-
105-
When `clients-config.json` is as following:
106-
107-
```json
108-
[
109-
{
110-
"ClientId": "implicit-mock-client",
111-
"Description": "Client for implicit flow",
112-
"AllowedGrantTypes": ["implicit"],
113-
"AllowAccessTokensViaBrowser": true,
114-
"RedirectUris": ["http://localhost:3000/auth/oidc", "http://localhost:4004/auth/oidc"],
115-
"AllowedScopes": ["openid", "profile", "email"],
116-
"IdentityTokenLifetime": 3600,
117-
"AccessTokenLifetime": 3600
118-
},
119-
{
120-
"ClientId": "client-credentials-mock-client",
121-
"ClientSecrets": ["client-credentials-mock-client-secret"],
122-
"Description": "Client for client credentials flow",
123-
"AllowedGrantTypes": ["client_credentials"],
124-
"AllowedScopes": ["some-app-scope-1"],
125-
"ClientClaimsPrefix": "",
126-
"Claims": [
127-
{
128-
"Type": "string_claim",
129-
"Value": "string_claim_value",
130-
"ValueType": "string"
131-
},
132-
{
133-
"Type": "json_claim",
134-
"Value": "[\"value1\", \"value2\"]",
135-
"ValueType": "json"
136-
}
137-
]
138-
}
139-
]
140-
```
141-
142-
This is the sample of using the server in `Dockerfile` configuration:
143-
144-
```
145-
# Use the base image
146-
FROM xdevsoftware/oidc-server-mock:0.8.6
147-
148-
# Set environment variables
149-
# additional configuration can be found in the readme
150-
# https://github.com/Soluto/oidc-server-mock/blob/master/README.md?plain=1#L145
151-
ENV ASPNETCORE_ENVIRONMENT=Development
152-
ENV SERVER_OPTIONS_INLINE="{ \
153-
\"AccessTokenJwtType\": \"JWT\", \
154-
\"Discovery\": { \
155-
\"ShowKeySet\": true \
156-
}, \
157-
\"Authentication\": { \
158-
\"CookieSameSiteMode\": \"Lax\", \
159-
\"CheckSessionCookieSameSiteMode\": \"Lax\" \
160-
} \
161-
}"
162-
ENV USERS_CONFIGURATION_INLINE="[ \
163-
{ \
164-
\"SubjectId\": \"1\", \
165-
\"Username\": \"User1\", \
166-
\"Password\": \"pwd\", \
167-
\"Claims\": [ \
168-
{ \
169-
\"Type\": \"name\", \
170-
\"Value\": \"Sam Tailor\", \
171-
\"ValueType\": \"string\" \
172-
}, \
173-
{ \
174-
\"Type\": \"email\", \
175-
\"Value\": \"[email protected]\", \
176-
\"ValueType\": \"string\" \
177-
}, \
178-
{ \
179-
\"Type\": \"some-api-resource-claim\", \
180-
\"Value\": \"Sam's Api Resource Custom Claim\", \
181-
\"ValueType\": \"string\" \
182-
}, \
183-
{ \
184-
\"Type\": \"some-api-scope-claim\", \
185-
\"Value\": \"Sam's Api Scope Custom Claim\", \
186-
\"ValueType\": \"string\" \
187-
}, \
188-
{ \
189-
\"Type\": \"some-identity-resource-claim\", \
190-
\"Value\": \"Sam's Identity Resource Custom Claim\", \
191-
\"ValueType\": \"string\" \
192-
} \
193-
] \
194-
} \
195-
]"
196-
ENV CLIENTS_CONFIGURATION_INLINE="[ \
197-
{ \
198-
\"ClientId\": \"some-client-di\", \
199-
\"ClientSecrets\": [\"some-client-Secret\"], \
200-
\"Description\": \"Client for authorization code flow\", \
201-
\"AllowedGrantTypes\": [\"authorization_code\"], \
202-
\"RequirePkce\": false, \
203-
\"AllowAccessTokensViaBrowser\": true, \
204-
\"RedirectUris\": [\"http://some-callback-url"], \
205-
\"AllowedScopes\": [\"openid\", \"profile\", \"email\"], \
206-
\"IdentityTokenLifetime\": 3600, \
207-
\"AccessTokenLifetime\": 3600, \
208-
\"RequireClientSecret\": false \
209-
} \
210-
]"
211-
ENV ASPNET_SERVICES_OPTIONS_INLINE="{ \
212-
\"ForwardedHeadersOptions\": { \
213-
\"ForwardedHeaders\": \"All\" \
214-
} \
215-
}"
216-
217-
# Expose the port
218-
EXPOSE 80
219-
220-
# Command to run the application
221-
CMD ["dotnet", "Soluto.OidcServerMock.dll"]
222-
```
223-
224-
Clients configuration should be provided. Test user configuration is optional (used for implicit flow only).
225-
226-
There are two ways to provide configuration for supported scopes, clients and users. You can either provide it inline as environment variable:
227-
228-
- `SERVER_OPTIONS_INLINE`
229-
- `LOGIN_OPTIONS_INLINE`
230-
- `LOGOUT_OPTIONS_INLINE`
231-
- `API_SCOPES_INLINE`
232-
- `USERS_CONFIGURATION_INLINE`
233-
- `CLIENTS_CONFIGURATION_INLINE`
234-
- `API_RESOURCES_INLINE`
235-
- `IDENTITY_RESOURCES_INLINE`
236-
237-
or mount volume and provide the path to configuration json as environment variable:
238-
239-
- `SERVER_OPTIONS_PATH`
240-
- `LOGIN_OPTIONS_PATH`
241-
- `LOGOUT_OPTIONS_PATH`
242-
- `API_SCOPES_PATH`
243-
- `USERS_CONFIGURATION_PATH`
244-
- `CLIENTS_CONFIGURATION_PATH`
245-
- `API_RESOURCES_PATH`
246-
- `IDENTITY_RESOURCES_PATH`
247-
248-
The configuration format can be Yaml or JSON both for inline or file path options.
249-
250-
In order to be able to override standard identity resources set `OVERRIDE_STANDARD_IDENTITY_RESOURCES` env var to `True`.
251-
252-
## Base path
253-
254-
The server can be configured to run with base path. So all the server endpoints will be also available with some prefix segment.
255-
For example `http://localhost:8080/my-base-path/.well-known/openid-configuration` and `http://localhost:8080/my-base-path/connect/token`.
256-
Just set `BasePath` property in `ASPNET_SERVICES_OPTIONS_INLINE/PATH` env var.
257-
258-
## Custom endpoints
259-
260-
### User management
261-
262-
Users can be added (in future also removed and altered) via `user management` endpoint.
263-
264-
- Create new user: `POST` request to `/api/v1/user` path.
265-
The request body should be the `User` object. Just as in `USERS_CONFIGURATION`.
266-
The response is subjectId as sent in request.
267-
268-
- Get user: `GET` request to `/api/v1/user/{subjectId}` path.
269-
The response is `User` object
270-
271-
- Update user `PUT` request to `/api/v1/user` path. (**Not implemented yet**)
272-
The request body should be the `User` object. Just as in `USERS_CONFIGURATION`.
273-
The response is subjectId as sent in request.
274-
275-
> If user doesn't exits it will be created.
276-
277-
- Delete user: `DELETE` request to `/api/v1/user/{subjectId}` path. (**Not implemented yet**)
278-
The response is `User` object
279-
280-
## HTTPS
281-
282-
To use `https` protocol with the server just add the following environment variables to the `docker run`/`docker-compose up` command, expose ports and mount volume containing the pfx file:
283-
284-
```yaml
285-
environment:
286-
ASPNETCORE_URLS: https://+:443;http://+:80
287-
ASPNETCORE_Kestrel__Certificates__Default__Password: <password for pfx file>
288-
ASPNETCORE_Kestrel__Certificates__Default__Path: /path/to/pfx/file
289-
volumes:
290-
- ./local/path/to/pfx/file:/path/to/pfx/file:ro
291-
ports:
292-
- 8080:80
293-
- 8443:443
294-
```
295-
296-
---
297-
298-
## Cookie SameSite mode
15+
## Usage
29916

300-
Since Aug 2020 Chrome has a new [secure-by-default model](https://blog.chromium.org/2019/10/developers-get-ready-for-new.html) for cookies, enabled by a new cookie classification system. Other browsers will join in near future.
17+
Usage guide can be found [upstream](https://github.com/Soluto/oidc-server-mock?tab=readme-ov-file).
30118

302-
There are two ways to use `oidc-server-mock` with this change.
19+
## Installation
20+
[Installation guide for the latest release](https://github.com/xdev-software/oidc-server-mock/releases/latest#Installation)
30321

304-
1. Run the container with HTTPS enabled (see above).
305-
2. Change cookies `SameSite` mode from default `None` to `Lax`. To do so just add the following to `SERVER_OPTIONS_INLINE` (or the file at `SERVER_OPTIONS_PATH`):
22+
<a href="https://hub.docker.com/r/xdevsoftware/oidc-server-mock">
23+
<img src="https://img.shields.io/docker/v/xdevsoftware/oidc-server-mock?sort=semver&logo=docker&label=DockerHub"/>
24+
<img src="https://img.shields.io/docker/pulls/xdevsoftware/oidc-server-mock?logo=docker&label=pulls"/>
25+
</a>
26+
<br/>
27+
<a href="https://github.com/xdev-software/oidc-server-mock/pkgs/container/oidc-server-mock">
28+
<img src="https://img.shields.io/badge/ghcr.io-available-blue?logo=docker"/>
29+
</a>
30630

307-
```javascript
308-
{
309-
// Existing configuration
310-
// ...
311-
"Authentication": {
312-
"CookieSameSiteMode": "Lax",
313-
"CheckSessionCookieSameSiteMode": "Lax"
314-
}
315-
}
316-
```
31+
## Support
32+
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).

0 commit comments

Comments
 (0)