Skip to content

Commit d3c3a63

Browse files
feat: add ETH Archive Service diagram
1 parent 8352c3f commit d3c3a63

File tree

1 file changed

+86
-62
lines changed

1 file changed

+86
-62
lines changed

β€Žauth.md

+86-62
Original file line numberDiff line numberDiff line change
@@ -122,96 +122,120 @@ sequenceDiagram
122122

123123
## Option C (Proposal Swen)
124124

125-
### Initial thoughts
125+
### Initial thoughts and running environment
126126

127127
**Ingestor**
128128

129-
- can run anywhere
130-
- therefore, it cannot contain any secret
131-
- needs to talk to SciCat and Archiver Service API
132-
- needs to be authorised with a user token
129+
- can run _either_ as a
130+
- central service
131+
- client application
132+
- if run as a client application:
133+
- cannot contain any secret (e.g. service account for SciCat)
134+
- app must be authorised by the user
133135

134136
**User**
135137

136-
- does not want to log in all the time
137-
- is only interested in starting a job
138+
- does not want to log in all the time (single sign-on preferred)
139+
- is only interested in _starting_ a job (fire and forget), e.g.
138140
- archive data
139141
- unarchive data
140-
- his authentication token can time out
142+
- the job itself needs to be able to report when its done, independently of the user
141143

142144
**SciCat**
143145

144146
- only accepts authenticated requests
147+
- currently only SciCat tokens
148+
- refresh tokens are not supported
149+
- Service Accounts
145150
- issues its own SciCat tokens (JWT with HS256 algorithm, aka Β«self signedΒ»)
146151
- after a user has successfully logged in to Keycloak
147-
- currently only accepts SciCat tokens
148-
- so it acts as an authority instance
149-
- offers a self-made mechanism to check if a SciCat token is valid
152+
- acts as an authority instance
153+
- issues SciCat tokens
154+
- offers a self-made mechanism to check validity of a SciCat token
150155

151-
**Archiver Service**
156+
**ETHZ Archiver Service**
152157

153158
- only accepts authenticated requests
154-
- issues Keycloak service tokens (JWT with RS256, public key signed)
155-
- currently only accepts JWT tokens issued and signed by Keycloak
156-
157-
### What needs to be done
158-
159-
- Archiver Service
160-
- needs to be able to accept SciCat πŸ”‘ as well (see ScopeMArchiver#146)
161-
- needs to be able to create valid SciCat πŸ”‘ (variant A)
162-
- SciCat
163-
- can exchange Ingestor JWT πŸ”‘ for Ingestor SciCat πŸ”‘ (variant B)
164-
- accepts all JWT πŸ”‘ issued and signed by Keycloak (variants C+D)
165-
166-
**Note**: the diagram below does not yet include any authorisation information. It only includes authentication. In future we would like to use JWT πŸ”‘ that contain authorisation information, e.g. tokens for every dataset upload.
159+
- JWT RS256 tokens issued and signed by Keycloak
160+
- JWT HS256 tokens issued by SciCat
161+
- can issue a Ingester token for a valid SciCat token
162+
- has service account for SciCat
163+
- must be able to report the status of a dataset any time to SciCat
164+
165+
### Use-case: User archives data (MinIO S3 Storage)
166+
167+
**Notes**:
168+
169+
- the diagram below does not include any authorisation information, only authentication.
170+
- In future we would like to use JWT πŸ”‘ that contain authorisation information, e.g. tokens for every dataset upload.
171+
- ETH use-case:
172+
- Ingestor can run as a service or a client application
173+
- does not contain any service account
174+
- exchanges the User SciCat πŸ”‘ to a Ingestor πŸ”‘ when starting upload (fire and forget)
175+
- use of MinIO S3 instead of Globus for upload
176+
- ETHZ Archiver Service has service accounts for:
177+
- **S3** to get pre-signed URLs for data upload
178+
- **SciCat** to report upload finish and schedule dataset archival
179+
- PSI use-case:
180+
- a) Ingestor is run as a service
181+
- Ingestor can contain a service account
182+
- Ingestor can report back to SciCat
183+
- b) Ingestor is run as a client application
184+
- Ingestor _cannot_ contain a service account
185+
- Ingestor _cannot_ report back to SciCat
186+
- instead, PSI needs to implement something similar like the ETHZ Archiver Service
167187

168188

169189
```mermaid
170190
sequenceDiagram
171191
autonumber
172192
participant B as Browser
173193
participant S as Scicat Backend
174-
participant I as Ingestor Service
175-
participant G as Storage (Globus)
194+
participant I as Ingestor Application/Service
176195
participant A as ETHZ Archiver Service
196+
participant M as MinIO S3 Storage
177197
participant K as Keycloak
178198
179-
B -) S: Access
199+
Note over B, K: Authorise User
200+
B -) S: request access
180201
S -) K: User Login (redirect)
181-
K --) S: User JWTπŸ”‘
182-
S ->> S: Exchange User JWT πŸ”‘ for SciCat πŸ”‘
183-
S --) B: User SciCat πŸ”‘
184-
B --) I: User SciCat πŸ”‘
185-
I --) A: User SciCat πŸ”‘
186-
alt tbd. ScopeMArchiver issue 146
187-
A -) S: verify + request User info (User SciCat πŸ”‘)
188-
S -) A: OK + User info
189-
end
190-
A -) K: request Ingestor JWT πŸ”‘ (user/pw)
191-
K --) A: Ingestor JWT πŸ”‘
192-
A --) I: Ingestor JWT πŸ”‘
193-
I ->> I: store refresh-token of Ingestor JWT πŸ”‘
194-
I -) A: request S3 credentials (Ingestor JWT πŸ”‘)
195-
A --) I: S3 credentials
196-
I ->> I: upload to S3 ⏳
197-
I -) A: report S3 upload finished (Ingestor JWT πŸ”‘)
198-
199-
alt Variant A: Archiver can create Ingestor SciCat πŸ”‘
200-
A -) S: request Ingestor SciCat πŸ”‘ (secret/Basic Auth)
201-
S --) A: Ingestor SciCat πŸ”‘
202-
A --) I: Ingestor SciCat πŸ”‘
203-
I -) S: report dataset upload finished (Ingestor SciCat πŸ”‘)
204-
else Variant B: SciCat exchanges Ingestor JWT πŸ”‘ for SciCat πŸ”‘
205-
I -) S: request Ingestor SciCat πŸ”‘ (Ingestor JWT πŸ”‘)
206-
S ->> S: Exchange Ingestor JWT πŸ”‘ for SciCat πŸ”‘
207-
S --) I: Ingestor SciCat πŸ”‘
208-
I -) S: report dataset upload finished (Ingestor SciCat πŸ”‘)
209-
else Variant C: SciCat accepts Ingestor JWT πŸ”‘
210-
I -) S: report archiving finished (Ingestor JWT πŸ”‘)
211-
else Variant D: Archiver report directly back to SciCat
212-
A ->> A: store Ingestor JWT πŸ”‘
213-
A ->> A: wait until upload is finished ⏳
214-
A -) S: report archiving finshed (Ingestor JWT πŸ”‘)
202+
K -) S: User JWTπŸ”‘
203+
S ->> S: Exchange User JWT πŸ”‘ β€”> User SciCat πŸ”‘
204+
S -) B: User SciCat πŸ”‘
205+
B -) I: provide User SciCat πŸ”‘ via Cookie
206+
207+
Note over S, I: Metadata exctraction
208+
B -) I: extract metadata
209+
I -) I: extract metadata
210+
I -) S: send metadata to SciCat (User SciCat πŸ”‘)
211+
212+
Note over B, K: ETH Archiver Service<br/>Authorise Ingestor
213+
I -) A: request /token (User SciCat πŸ”‘)
214+
A -) S: verify + request User info (User SciCat πŸ”‘)
215+
S -) A: OK + User info πŸ“œ
216+
A -) K: request Ingestor JWT πŸ”‘ (Keycloak Service Account πŸ”‘)
217+
K -) A: Ingestor JWT πŸ”‘ + refresh πŸ”‘
218+
A -) I: Ingestor JWT πŸ”‘ + refresh πŸ”‘
219+
220+
221+
Note over I, K: Get presigned S3 URLs for upload
222+
I -) A: request S3 URLs (Ingestor JWT πŸ”‘)
223+
A -) M: request S3 URLs (MinIO πŸ”‘)
224+
M -) A: S3 URLs πŸ”‘
225+
A -) I: S3 URLs πŸ”‘
226+
227+
Note over I, K: Upload data (refresh tokens)
228+
I -) M: upload data (S3 URLs πŸ”‘) ⏳
229+
loop renew Ingestor JWT πŸ”‘ if needed
230+
I -) K: request Ingestor JWT (refresh πŸ”‘)
231+
K -) I: new Ingestor JWT πŸ”‘ + refresh πŸ”‘
215232
end
216233
234+
Note over S, M: Report upload finished
235+
236+
I -) A: report data upload to MinIO finished (Ingestor JWT πŸ”‘)
237+
A -) M: finish upload workflow
238+
A -) S: report upload finished (Service Account πŸ”‘)
239+
A -) S: schedule archiving (Service Account πŸ”‘)
240+
217241
```

0 commit comments

Comments
Β (0)