-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add an optional authentication mode for HTTP resources #58589
Merged
Merged
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
89a1eff
add authRequred: 'optional'
mshustov 0f3a915
expose auth status via request context
mshustov 05809a4
update security plugin to use notHandled auth outcome
mshustov fc94baa
capabilities service uses optional auth
mshustov de22f7e
update tests
mshustov 97ac4a3
Merge branch 'master' into issue-41959-optional-auth
mshustov 006edef
attach security headers only to unauthorised response
mshustov 529eeee
add isAuthenticated tests for 'optional' auth mode
mshustov 4c9f0bc
security plugin relies on http.auth.isAuthenticated to calc capabilities
mshustov a2f2546
generate docs
mshustov 9bec57f
reword test suit names
mshustov 6c4de35
Merge branch 'master' into issue-41959-optional-auth
mshustov 82835fc
update tests
mshustov 526922b
Merge branch 'master' into issue-41959-optional-auth
mshustov 46b5232
update test checking isAuth on optional auth path
mshustov 2c2cbe1
address Oleg comments
mshustov 0801b08
add test for auth: try
mshustov 64ff1ac
fix
mshustov afa6d4b
pass isAuthenticted as boolean via context
mshustov cc3d95c
remove response header from notHandled
mshustov e96158b
update docs
mshustov 9750ce1
add redirected for auth interceptor
mshustov 5efb16a
security plugin uses t.redirected to be compat with auth: optional
mshustov c5cb1fd
update docs
mshustov fcb4994
require location header in the interface
mshustov f1ecba3
address comments #1
mshustov f6dad7f
declare isAuthenticated on KibanaRequest
mshustov d1901a8
remove auth.isAuthenticated from scope
mshustov 0275e25
update docs
mshustov 8b2a817
Merge branch 'master' into issue-41959-optional-auth
mshustov 01d995c
remove unnecessary comment
mshustov f177d69
do not fail on FakrRequest
mshustov 86f4603
small improvements
mshustov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
docs/development/core/server/kibana-plugin-server.authnothandled.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [AuthNotHandled](./kibana-plugin-server.authnothandled.md) | ||
|
||
## AuthNotHandled interface | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface AuthNotHandled | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [type](./kibana-plugin-server.authnothandled.type.md) | <code>AuthResultType.notHandled</code> | | | ||
|
11 changes: 11 additions & 0 deletions
11
docs/development/core/server/kibana-plugin-server.authnothandled.type.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [AuthNotHandled](./kibana-plugin-server.authnothandled.md) > [type](./kibana-plugin-server.authnothandled.type.md) | ||
|
||
## AuthNotHandled.type property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
type: AuthResultType.notHandled; | ||
``` |
19 changes: 19 additions & 0 deletions
19
docs/development/core/server/kibana-plugin-server.authredirected.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [AuthRedirected](./kibana-plugin-server.authredirected.md) | ||
|
||
## AuthRedirected interface | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface AuthRedirected extends AuthRedirectedParams | ||
``` | ||
## Properties | ||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [type](./kibana-plugin-server.authredirected.type.md) | <code>AuthResultType.redirected</code> | | | ||
11 changes: 11 additions & 0 deletions
11
docs/development/core/server/kibana-plugin-server.authredirected.type.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [AuthRedirected](./kibana-plugin-server.authredirected.md) > [type](./kibana-plugin-server.authredirected.type.md) | ||
|
||
## AuthRedirected.type property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
type: AuthResultType.redirected; | ||
``` |
15 changes: 15 additions & 0 deletions
15
docs/development/core/server/kibana-plugin-server.authredirectedparams.headers.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [AuthRedirectedParams](./kibana-plugin-server.authredirectedparams.md) > [headers](./kibana-plugin-server.authredirectedparams.headers.md) | ||
|
||
## AuthRedirectedParams.headers property | ||
|
||
Headers to attach for auth redirect. Must include "location" header | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
headers: { | ||
location: string; | ||
} & ResponseHeaders; | ||
``` |
20 changes: 20 additions & 0 deletions
20
docs/development/core/server/kibana-plugin-server.authredirectedparams.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [AuthRedirectedParams](./kibana-plugin-server.authredirectedparams.md) | ||
|
||
## AuthRedirectedParams interface | ||
|
||
Result of auth redirection. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface AuthRedirectedParams | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [headers](./kibana-plugin-server.authredirectedparams.headers.md) | <code>{</code><br/><code> location: string;</code><br/><code> } & ResponseHeaders</code> | Headers to attach for auth redirect. Must include "location" header | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
docs/development/core/server/kibana-plugin-server.authtoolkit.nothandled.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [AuthToolkit](./kibana-plugin-server.authtoolkit.md) > [notHandled](./kibana-plugin-server.authtoolkit.nothandled.md) | ||
|
||
## AuthToolkit.notHandled property | ||
|
||
User has no credentials. Allows user to access a resource when authRequired: 'optional' Rejects a request when authRequired: true | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
notHandled: () => AuthResult; | ||
``` |
15 changes: 15 additions & 0 deletions
15
docs/development/core/server/kibana-plugin-server.authtoolkit.redirected.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [AuthToolkit](./kibana-plugin-server.authtoolkit.md) > [redirected](./kibana-plugin-server.authtoolkit.redirected.md) | ||
|
||
## AuthToolkit.redirected property | ||
|
||
Redirect user to IdP when authRequired: true Allows user to access a resource without redirection when authRequired: 'optional' | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
redirected: (headers: { | ||
location: string; | ||
} & ResponseHeaders) => AuthResult; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,6 @@ import { InternalHttpServiceSetup } from '../../http'; | |
import { registerCapabilitiesRoutes } from './resolve_capabilities'; | ||
|
||
export function registerRoutes(http: InternalHttpServiceSetup, resolver: CapabilitiesResolver) { | ||
const router = http.createRouter('/api/core/capabilities'); | ||
const router = http.createRouter(''); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NIT: why remove the prefix here? |
||
registerCapabilitiesRoutes(router, resolver); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍