Skip to content

Commit

Permalink
Generates random password for anonymous user
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Mar 12, 2024
1 parent 5492d2a commit 9d47261
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* permissions and limitations under the License.
*/

import { randomString } from "@hapi/cryptiles";

Check failure on line 16 in common/index.ts

View workflow job for this annotation

GitHub Actions / Run unit tests (ubuntu-latest)

Replace `"@hapi/cryptiles"` with `'@hapi/cryptiles'`

Check failure on line 16 in common/index.ts

View workflow job for this annotation

GitHub Actions / Run unit tests (macos-latest)

Replace `"@hapi/cryptiles"` with `'@hapi/cryptiles'`

Check failure on line 16 in common/index.ts

View workflow job for this annotation

GitHub Actions / Run unit tests (windows-latest)

Replace `"@hapi/cryptiles"` with `'@hapi/cryptiles'`

export const PLUGIN_ID = 'opensearchDashboardsSecurity';
export const PLUGIN_NAME = 'security-dashboards-plugin';

Expand All @@ -34,8 +36,10 @@ export const OPENID_AUTH_LOGIN_WITH_FRAGMENT = '/auth/openid/captureUrlFragment'
export const SAML_AUTH_LOGIN = '/auth/saml/login';
export const SAML_AUTH_LOGIN_WITH_FRAGMENT = '/auth/saml/captureUrlFragment';
export const ANONYMOUS_AUTH_LOGIN = '/auth/anonymous';
export const ANONYMOUS_AUTH_HEADER =
'Basic b3BlbmRpc3Ryb19zZWN1cml0eV9hbm9ueW1vdXM6b3BlbmRpc3Ryb19zZWN1cnV0eV9hbm9ueW1vdXM=';
const ANONYMOUS_AUTH_USER: string = 'opendistro_security_anonymous';
const RANDOM_PASS: string = randomString(12);
const ANONYMOUS_USER_PASS: string = `${ANONYMOUS_AUTH_USER}:${RANDOM_PASS}`;
export const ANONYMOUS_AUTH_HEADER = `Basic ${Buffer.from(ANONYMOUS_USER_PASS).toString('base64')}`

Check failure on line 42 in common/index.ts

View workflow job for this annotation

GitHub Actions / Run unit tests (ubuntu-latest)

Insert `;`

Check failure on line 42 in common/index.ts

View workflow job for this annotation

GitHub Actions / Run unit tests (macos-latest)

Insert `;`

Check failure on line 42 in common/index.ts

View workflow job for this annotation

GitHub Actions / Run unit tests (windows-latest)

Insert `;`

export const OPENID_AUTH_LOGOUT = '/auth/openid/logout';
export const SAML_AUTH_LOGOUT = '/auth/saml/logout';
Expand Down

0 comments on commit 9d47261

Please sign in to comment.