Skip to content

Commit 0d60c2c

Browse files
251 docs
1 parent 0da4715 commit 0d60c2c

File tree

4 files changed

+69
-53
lines changed

4 files changed

+69
-53
lines changed

lapis-docs/src/components/AuthenticationExamples.astro

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
import { Code, Aside } from '@astrojs/starlight/components';
3+
import { getLapisUrl } from '../lapisUrl';
4+
import { OnlyIf } from './OnlyIf.tsx';
5+
6+
const lapisUrl = getLapisUrl();
7+
8+
async function instanceRequiresAuthentication() {
9+
try {
10+
const response = await fetch(`${lapisUrl}/sample/info`);
11+
return response.status === 401;
12+
} catch (error) {
13+
console.error('Error checking authentication requirement:', error);
14+
return false;
15+
}
16+
}
17+
18+
const requiresAuth = await instanceRequiresAuthentication();
19+
---
20+
21+
<Aside type='note'
22+
>This LAPIS instance <b>{requiresAuth ? 'requires' : 'does not require'} authentication</b> to access its data.</Aside
23+
>
24+
25+
<p>
26+
Some LAPIS instances require authentication to access their data. If an instance is configured with authentication,
27+
you need to include a valid access token in your requests.
28+
</p>
29+
30+
<h2>Checking if Authentication is Required</h2>
31+
<p>Try accessing any endpoint without authentication:</p>
32+
33+
<Code lang='bash' code={`curl ${lapisUrl}/sample/info -v`} />
34+
<p>
35+
If authentication is required, you'll receive a <code>401 Unauthorized</code> response and the output will contains something
36+
like
37+
</p>
38+
<Code code='> ...\n< HTTP/1.1 401\n< ...' />
39+
40+
<p>If the instance is open (no authentication), you'll receive the normal response data.</p>
41+
42+
<h2>Getting an Access Token</h2>
43+
44+
<p>
45+
Contact the LAPIS instance administrator to learn how to obtain an access token. The method depends on the identity
46+
provider configured for that instance. Common methods include:
47+
<ul>
48+
<li><b>Username/password</b> - Exchange credentials for a token</li>
49+
<li><b>Client credentials</b> - Use a client ID and secret</li>
50+
<li><b>OAuth 2.0 flows</b> - Authorization code, device flow, etc.</li>
51+
</ul>
52+
</p>
53+
54+
<h2>Making Authenticated Requests</h2>
55+
<p>
56+
To make authenticated requests to LAPIS, include the access token in the <code>Authorization</code> header using the <code
57+
>Bearer</code
58+
> scheme:
59+
60+
<Code lang='bash' code={`curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ${lapisUrl}/sample/aggregated`} />
61+
</p>

lapis-docs/src/content/docs/concepts/authentication.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ title: Authentication
33
description: How to authenticate requests to LAPIS
44
---
55

6-
import AuthenticationExamples from '../../../components/AuthenticationExamples.astro';
6+
import UserAuthentication from '../../../components/UserAuthentication.astro';
77

8-
<AuthenticationExamples />
8+
<UserAuthentication />

lapis-docs/src/content/docs/maintainer-docs/references/authentication.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ LAPIS supports three methods for JWT validation:
2727
Specify the URL where LAPIS can fetch the public keys used to verify JWT signatures:
2828

2929
**Example with Keycloak:**
30+
3031
```bash
3132
--spring.security.oauth2.resourceserver.jwt.jwk-set-uri=https://keycloak.example.com/realms/lapis/protocol/openid-connect/certs
3233
```
3334

3435
**When to use:**
36+
3537
- You know the exact JWK Set endpoint URL
3638
- You want explicit control over the key source
3739
- Fastest startup (no auto-discovery needed)
@@ -42,11 +44,13 @@ Specify the OAuth 2.0 issuer URI,
4244
and LAPIS will auto-discover the JWK Set URI via the `.well-known/openid-configuration` endpoint:
4345

4446
**Example with Keycloak:**
47+
4548
```bash
4649
--spring.security.oauth2.resourceserver.jwt.issuer-uri=https://keycloak.example.com/realms/lapis
4750
```
4851

4952
**When to use:**
53+
5054
- You want LAPIS to auto-discover OAuth configuration
5155
- Your identity provider follows OpenID Connect standards
5256

@@ -59,11 +63,13 @@ For testing or air-gapped environments, you can provide a PEM-encoded RSA public
5963
```
6064

6165
**When to use:**
66+
6267
- Testing and development
6368
- Air-gapped deployments
6469
- Static key infrastructure
6570

6671
**Public key format (RSA 2048-bit or higher):**
72+
6773
```
6874
-----BEGIN PUBLIC KEY-----
6975
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...

0 commit comments

Comments
 (0)