Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: adding flow diagrams for interactions #247

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions docs/flows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# AD Server Interactions

AD LDAP Connector helps facilitate proxied interactions to an LDAP server. The connector provides a set of
APIs that mirrors the interactions with other connections e.g. Custom Database Connections.

In the diagrams below the following names will be used to indicate the defined participants:

- CIC: The environment of Okta CIC (Auth0) that is being interacted with
- Connector: A running instance of the application defined in this repository
- AD: An active directory implementation that is the backend for the Auth0 connection

All three components act as servers, only the first two act as clients.

## Boot

### Client Instantiation

```mermaid
sequenceDiagram
Connector ->> AD : Create Connection
Connector ->> AD : Bind Connection
Note right of Connector: referred to as Client
Connector ->> AD : Create Connection
Note right of Connector: referred to as Binder
```

### Health Check

```mermaid
sequenceDiagram
Connector ->> AD : Create Connection
loop HealthCheck
Connector ->> AD : Bind Connection
Connector ->> AD : Search
Connector ->> Connector : Update Health
end
```

## HTTP Server

- Source: [endpoints.js](endpoints.js)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL returns 404

- Handled by Password WindowsAuthentication implementation:
- https://github.com/auth0/passport-windowsauth

### Login

- Endpoint: `/wsfed`

### List Users

- Endpoint: `/users`

## Proxied Interactions

- Source: [ws_validator.js](ws_validator.js)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. URL return 404

- Ingress: Websocket

### Authenticate User

- Event: `authenticate_user`
```mermaid
sequenceDiagram
Auth0 ->> Connector : Authenticate User
note right of Auth0 : Username, Password
Connector ->> AD : Search with Client
AD ->> Connector : User
alt if user found
Connector ->> AD : Bind with Binder
alt not successful
Connector ->> Auth0 : Error
else
alt if groups enabled
Connector ->> Connector : Check Cache
alt if cache empty
Connector ->> AD : Search with Client
AD ->> Connector : Groups
end
end
Connector ->> Auth0 : User
end
end
```

### Search Users

- Event: `search_users`

```mermaid
sequenceDiagram
Auth0 ->> Connector : Search Users
Connector ->> AD : Search with Client
AD ->> Connector : Users
alt if groups enabled
Connector ->> Connector : Check Cache
alt if cache empty
Connector ->> AD : Search with Client
AD ->> Connector : Groups

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Should we also add Connector ->> Auth0 : User

end
end
```

### Change Password

- Event: `change_password`

```mermaid
sequenceDiagram
Auth0 ->> Connector : Change Password
note right of Auth0 : Username, Password
Connector ->> AD : Search
AD ->> Connector : Users
alt if user found
Connector ->> AD : Modify
alt if groups enabled
Connector ->> Connector : Check Cache
alt if cache empty
Connector ->> AD : Search with Client
AD ->> Connector : Groups
end
end
Connector ->> Connector : Create Profile
Connector ->> Auth0 : User
else
Connector ->> Auth0 : Error
end
```

### List Groups

- Event: `list_groups`

```mermaid
sequenceDiagram
Auth0 ->> Connector : List Groups
Connector ->> AD : Search with Client
AD ->> Connector : Groups
Connector ->> Auth0 : Groups
```