eager-finland-59914
09/05/2024, 9:59 PMsteep-lamp-91158
eager-finland-59914
09/11/2024, 5:04 PMred-machine-69654
10/01/2024, 11:57 AMX-Token
So in the end we can have requests against oathkeeper with an api token value, that value is validated by the (fake oauth2_introspection) endpoint and the configured flow. The return value in our case is something like, {"user":"xxx", "settings": "..."}
which oathkeeper adds to the request and passes it on to our backends.
Not sure if there's anything better? ๐steep-lamp-91158
bearer_token: {
enabled: true,
config: {
prefix: 'ory_pat_',
check_session_url: '<https://backend>',
subject_from: 'id',
preserve_path: true,
preserve_host: false,
// We need to force POST here because on HEAD requests the body is not sent & received.
force_method: 'POST',
// We add some extra info for later steps here.
extra_from: '[@this,{"namespace":!"ApiKey"}].@join',
},
},
Not sure if the bearer token prefix is available on the latest release or only when you build from master though. Maybe this can help you somehow still.red-machine-69654
10/01/2024, 12:50 PMsteep-lamp-91158
red-machine-69654
10/01/2024, 5:22 PMsteep-lamp-91158
{
id: '...',
match: {
methods: [
'GET',
'HEAD',
'POST',
'PUT',
'PATCH',
'DELETE',
],
url: '...',
},
authenticators: [
{
handler: 'cookie_session',
},
{
handler: 'bearer_token', // API key type 1
config: {
prefix: 'api_key_1_',
check_session_url: '...',
subject_from: '...',
preserve_path: true,
preserve_host: true,
// We need to force POST here because on HEAD requests the body is not sent & received.
force_method: 'POST',
extra_from: '[@this,{"namespace":!"ApiKey"}].@join',
},
},
{
handler: 'bearer_token', // API key type 2
config: {
prefix: 'api_key_2_',
check_session_url: '....',
subject_from: '...',
preserve_path: true,
preserve_host: true,
// We need to force POST here because on HEAD requests the body is not sent & received.
force_method: 'POST',
extra_from: '[@this,{"namespace":!"ApiKey"}].@join',
},
},
{
handler: 'oauth2_introspection',
},
],
authorizer: {
handler: 'allow',
},
mutators: [
{
handler: 'id_token',
},
],
upstream: {
....
},
},
red-machine-69654
10/02/2024, 4:23 PM