-
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
introduce pre-/post-auth request hooks for HttpServer #36690
Merged
mshustov
merged 21 commits into
elastic:master
from
mshustov:issue-33775-introduce-pre-post-auth
May 29, 2019
Merged
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ddd5fe5
introduce pre-,post-auth stages
mshustov 112f30e
cleanup integration_tests. now contracts available in tests
mshustov 4ce4967
auth per route is configurable
mshustov 013d815
Unify lifecycle results structure
mshustov 84c5c1d
expose api to store auth state and status via http service
mshustov e0a607b
update tests
mshustov 4f75b71
update docs
mshustov 68ec950
Merge branch 'master' into issue-33775-introduce-pre-post-auth
mshustov 52360f6
Merge branch 'master' into issue-33775-introduce-pre-post-auth
mshustov 2517c97
use full name, auth should not mutate request
mshustov 9599d32
move basePath functionality under namespace
mshustov 1799d3b
regenerate docs
mshustov f2a0aee
Revert "move basePath functionality under namespace"
mshustov 8aad6f3
Revert "regenerate docs"
mshustov 14667d3
regenerate docs
mshustov 39feb77
updated yarn.lock no idea why
mshustov 9735891
extract AuthStateStorage to a separate entity
mshustov b529a1a
Merge branch 'master' into issue-33775-introduce-pre-post-auth
mshustov aa72f91
get rid of nested ifs
mshustov ea1edee
describe what is the difference between hooks
mshustov b8d6041
re-wording
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
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
11 changes: 11 additions & 0 deletions
11
docs/development/core/server/kibana-plugin-server.kibanarequest.url.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) > [kibana-plugin-server](./kibana-plugin-server.md) > [KibanaRequest](./kibana-plugin-server.kibanarequest.md) > [url](./kibana-plugin-server.kibanarequest.url.md) | ||
|
||
## KibanaRequest.url property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly url: Url; | ||
``` |
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
12 changes: 12 additions & 0 deletions
12
docs/development/core/server/kibana-plugin-server.onpostauthhandler.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,12 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index) > [kibana-plugin-server](./kibana-plugin-server.md) > [OnPostAuthHandler](./kibana-plugin-server.onpostauthhandler.md) | ||
|
||
## OnPostAuthHandler type | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type OnPostAuthHandler<Params = any, Query = any, Body = any> = (req: KibanaRequest<Params, Query, Body>, t: OnPostAuthToolkit) => OnPostAuthResult | Promise<OnPostAuthResult>; | ||
``` |
22 changes: 22 additions & 0 deletions
22
docs/development/core/server/kibana-plugin-server.onpostauthtoolkit.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,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index) > [kibana-plugin-server](./kibana-plugin-server.md) > [OnPostAuthToolkit](./kibana-plugin-server.onpostauthtoolkit.md) | ||
|
||
## OnPostAuthToolkit interface | ||
|
||
A tool set defining an outcome of OnPostAuth interceptor for incoming request. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface OnPostAuthToolkit | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [next](./kibana-plugin-server.onpostauthtoolkit.next.md) | <code>() => OnPostAuthResult</code> | To pass request to the next handler | | ||
| [redirected](./kibana-plugin-server.onpostauthtoolkit.redirected.md) | <code>(url: string) => OnPostAuthResult</code> | To interrupt request handling and redirect to a configured url | | ||
| [rejected](./kibana-plugin-server.onpostauthtoolkit.rejected.md) | <code>(error: Error, options?: {`<p/>` statusCode?: number;`<p/>` }) => OnPostAuthResult</code> | Fail the request with specified error. | | ||
|
13 changes: 13 additions & 0 deletions
13
docs/development/core/server/kibana-plugin-server.onpostauthtoolkit.next.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) > [kibana-plugin-server](./kibana-plugin-server.md) > [OnPostAuthToolkit](./kibana-plugin-server.onpostauthtoolkit.md) > [next](./kibana-plugin-server.onpostauthtoolkit.next.md) | ||
|
||
## OnPostAuthToolkit.next property | ||
|
||
To pass request to the next handler | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
next: () => OnPostAuthResult; | ||
``` |
13 changes: 13 additions & 0 deletions
13
docs/development/core/server/kibana-plugin-server.onpostauthtoolkit.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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index) > [kibana-plugin-server](./kibana-plugin-server.md) > [OnPostAuthToolkit](./kibana-plugin-server.onpostauthtoolkit.md) > [redirected](./kibana-plugin-server.onpostauthtoolkit.redirected.md) | ||
|
||
## OnPostAuthToolkit.redirected property | ||
|
||
To interrupt request handling and redirect to a configured url | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
redirected: (url: string) => OnPostAuthResult; | ||
``` |
15 changes: 15 additions & 0 deletions
15
docs/development/core/server/kibana-plugin-server.onpostauthtoolkit.rejected.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) > [kibana-plugin-server](./kibana-plugin-server.md) > [OnPostAuthToolkit](./kibana-plugin-server.onpostauthtoolkit.md) > [rejected](./kibana-plugin-server.onpostauthtoolkit.rejected.md) | ||
|
||
## OnPostAuthToolkit.rejected property | ||
|
||
Fail the request with specified error. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
rejected: (error: Error, options?: { | ||
statusCode?: number; | ||
}) => OnPostAuthResult; | ||
``` |
12 changes: 12 additions & 0 deletions
12
docs/development/core/server/kibana-plugin-server.onpreauthhandler.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,12 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index) > [kibana-plugin-server](./kibana-plugin-server.md) > [OnPreAuthHandler](./kibana-plugin-server.onpreauthhandler.md) | ||
|
||
## OnPreAuthHandler type | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type OnPreAuthHandler<Params = any, Query = any, Body = any> = (req: KibanaRequest<Params, Query, Body>, t: OnPreAuthToolkit) => OnPreAuthResult | Promise<OnPreAuthResult>; | ||
``` |
22 changes: 22 additions & 0 deletions
22
docs/development/core/server/kibana-plugin-server.onpreauthtoolkit.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,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index) > [kibana-plugin-server](./kibana-plugin-server.md) > [OnPreAuthToolkit](./kibana-plugin-server.onpreauthtoolkit.md) | ||
|
||
## OnPreAuthToolkit interface | ||
|
||
A tool set defining an outcome of OnPreAuth interceptor for incoming request. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface OnPreAuthToolkit | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [next](./kibana-plugin-server.onpreauthtoolkit.next.md) | <code>() => OnPreAuthResult</code> | To pass request to the next handler | | ||
| [redirected](./kibana-plugin-server.onpreauthtoolkit.redirected.md) | <code>(url: string, options?: {`<p/>` forward: boolean;`<p/>` }) => OnPreAuthResult</code> | To interrupt request handling and redirect to a configured url. If "options.forwarded" = true, request will be forwarded to another url right on the server. | | ||
| [rejected](./kibana-plugin-server.onpreauthtoolkit.rejected.md) | <code>(error: Error, options?: {`<p/>` statusCode?: number;`<p/>` }) => OnPreAuthResult</code> | Fail the request with specified error. | | ||
|
6 changes: 3 additions & 3 deletions
6
...na-plugin-server.onrequesttoolkit.next.md → ...na-plugin-server.onpreauthtoolkit.next.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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index) > [kibana-plugin-server](./kibana-plugin-server.md) > [OnRequestToolkit](./kibana-plugin-server.onrequesttoolkit.md) > [next](./kibana-plugin-server.onrequesttoolkit.next.md) | ||
[Home](./index) > [kibana-plugin-server](./kibana-plugin-server.md) > [OnPreAuthToolkit](./kibana-plugin-server.onpreauthtoolkit.md) > [next](./kibana-plugin-server.onpreauthtoolkit.next.md) | ||
|
||
## OnRequestToolkit.next property | ||
## OnPreAuthToolkit.next property | ||
|
||
To pass request to the next handler | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
next: () => OnRequestResult; | ||
next: () => OnPreAuthResult; | ||
``` |
15 changes: 15 additions & 0 deletions
15
docs/development/core/server/kibana-plugin-server.onpreauthtoolkit.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) > [kibana-plugin-server](./kibana-plugin-server.md) > [OnPreAuthToolkit](./kibana-plugin-server.onpreauthtoolkit.md) > [redirected](./kibana-plugin-server.onpreauthtoolkit.redirected.md) | ||
|
||
## OnPreAuthToolkit.redirected property | ||
|
||
To interrupt request handling and redirect to a configured url. If "options.forwarded" = true, request will be forwarded to another url right on the server. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
redirected: (url: string, options?: { | ||
forward: boolean; | ||
}) => OnPreAuthResult; | ||
``` |
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
12 changes: 0 additions & 12 deletions
12
docs/development/core/server/kibana-plugin-server.onrequesthandler.md
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
docs/development/core/server/kibana-plugin-server.onrequesttoolkit.md
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
docs/development/core/server/kibana-plugin-server.onrequesttoolkit.redirected.md
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
docs/development/core/server/kibana-plugin-server.onrequesttoolkit.seturl.md
This file was deleted.
Oops, something went wrong.
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.
@eliperelman what do you think if we allocate basePath functionality under
basePath
namespace in httpSetup? If you agree on this interface, I can implement for server side as a part of #35816There 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.
I think this makes sense. I like it.