Skip to content

Commit 95e4eca

Browse files
committed
docs: add authentication section
1 parent dd1796f commit 95e4eca

File tree

1 file changed

+66
-2
lines changed

1 file changed

+66
-2
lines changed

docs/Architecture.md

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ GitProxy has several main components:
1010

1111
- Proxy (`/src/proxy`): The actual proxy for Git. Git operations performed by users are intercepted here to apply the relevant **chain**. Also loads **plugins** and adds them to the chain. Runs by default on port `8000`.
1212
- Chain: A set of **processors** that are applied to an action (i.e. a `git push` operation) before requesting review from an approved user
13-
- Processor: AKA `Step`. A specific step in the chain where certain rules are applied. See the list of default processors below for more details.`
14-
<!-- Todo: link to processor list -->
13+
- Processor: AKA `Step`. A specific step in the chain where certain rules are applied. See the [list of default processors](#processors) below for more details.`
1514
- Plugin: A custom processor that can be added externally to extend GitProxy's default policies. See the plugin guide for more details.
1615
<!-- Todo: Add link to plugin guide -->
1716
- Service/API (`/src/service`): Handles UI requests, user authentication to GitProxy (not to Git), database operations and some of the logic for rejection/approval. Runs by default on port `8080`.
@@ -309,3 +308,68 @@ Note that this message will show again even if the push had been previously reje
309308
<!-- Todo: Add image displaying successful chain execution -->
310309

311310
Source: [/src/proxy/processors/push-action/blockForAuth.ts](/src/proxy/processors/push-action/blockForAuth.ts)
311+
312+
### Authentication
313+
314+
Currently, three different authentication methods are provided for interacting with the UI and adding users. This can be configured by editing the `authentication` array in `proxy.config.json`.
315+
316+
#### Local
317+
318+
Default username/password auth method. Note that this authentication method does not allow adding users directly from the UI (`/api/auth/create-user` must be used instead).
319+
320+
Default accounts are provided for testing:
321+
322+
- Admin: Username: `admin`, Password: `admin`
323+
- User: Username: `user`, Password: `user`
324+
325+
#### ActiveDirectory
326+
327+
Allows AD authentication and user management. The following parameters must be configured in `proxy.config.json`, and `enabled` must be set to `true`:
328+
329+
```json
330+
{
331+
"type": "ActiveDirectory",
332+
"enabled": false,
333+
"adminGroup": "",
334+
"userGroup": "",
335+
"domain": "",
336+
"adConfig": {
337+
"url": "",
338+
"baseDN": "",
339+
"searchBase": "",
340+
"username": "",
341+
"password": ""
342+
}
343+
}
344+
```
345+
346+
#### OpenID Connect
347+
348+
Allows authenticating to OIDC. The following parameters must be configured in `proxy.config.json`, and `enabled` must be set to `true`:
349+
350+
```json
351+
{
352+
"type": "openidconnect",
353+
"enabled": false,
354+
"oidcConfig": {
355+
"issuer": "",
356+
"clientID": "",
357+
"clientSecret": "",
358+
"callbackURL": "",
359+
"scope": ""
360+
}
361+
}
362+
```
363+
364+
When logging in for the first time, this will create a GitProxy user with the email associated to the OIDC, the user will be set to the local portion of the email.
365+
366+
For example: logging in with myusername@mymail.com will create a new user with username set to `myusername`.
367+
368+
#### Adding new methods
369+
370+
New methods can be added by:
371+
372+
1. Extending `/src/service/passport` with the relevant [passport.js strategy](https://www.passportjs.org/packages/).
373+
- The strategy file must have a `configure` method and a `type` string to match with the config method. See the pre-existing methods in [`/src/service/passport`](/src/service/passport) for more details.
374+
2. Creating a `proxy.config.json` entry with the required configuration parameters
375+
3. Importing the new strategy and adding it to the `authStrategies` array in `/src/service/passport/index.ts`

0 commit comments

Comments
 (0)