-
Notifications
You must be signed in to change notification settings - Fork 17
feat: add support for csrf #2604
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,7 +27,11 @@ export class YdbEmbeddedAPI { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| meta?: MetaAPI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| codeAssist?: CodeAssistAPI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| constructor({webVersion = false, withCredentials = false} = {}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| constructor({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| webVersion = false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| withCredentials = false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| csrfTokenGetter = () => undefined, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } = {}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const config: AxiosRequestConfig = {withCredentials}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.auth = new AuthAPI({config}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -47,5 +51,20 @@ export class YdbEmbeddedAPI { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| this.tablets = new TabletsAPI({config}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.vdisk = new VDiskAPI({config}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.viewer = new ViewerAPI({config}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const token = csrfTokenGetter(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (token) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.auth.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.meta?.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.codeAssist?.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.operation.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.pdisk.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.scheme.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.storage.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.streaming.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.tablets.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.vdisk.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.viewer.setCSRFToken(token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.auth.setCSRFToken(token); | |
| this.meta?.setCSRFToken(token); | |
| this.codeAssist?.setCSRFToken(token); | |
| this.operation.setCSRFToken(token); | |
| this.pdisk.setCSRFToken(token); | |
| this.scheme.setCSRFToken(token); | |
| this.storage.setCSRFToken(token); | |
| this.streaming.setCSRFToken(token); | |
| this.tablets.setCSRFToken(token); | |
| this.vdisk.setCSRFToken(token); | |
| this.viewer.setCSRFToken(token); | |
| const services = [ | |
| this.auth, | |
| this.meta, | |
| this.codeAssist, | |
| this.operation, | |
| this.pdisk, | |
| this.scheme, | |
| this.storage, | |
| this.streaming, | |
| this.tablets, | |
| this.vdisk, | |
| this.viewer, | |
| ]; | |
| services.forEach(service => service?.setCSRFToken(token)); |
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.
dont like
Uh oh!
There was an error while loading. Please reload this page.