Skip to content

Commit

Permalink
Update auth for new backend
Browse files Browse the repository at this point in the history
  • Loading branch information
GDYendell committed Jan 27, 2025
1 parent 1c64952 commit 45cc39c
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 72 deletions.
4 changes: 1 addition & 3 deletions backstage/app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ backend:
- host: raw.githubusercontent.com
paths:
- /DiamondLightSource
# Disable new default auth to work with legacy plugins
auth:
dangerouslyDisableDefaultAuthPolicy: true

integrations:
github:
Expand All @@ -56,6 +53,7 @@ techdocs:
auth:
environment: development
providers:
guest: {}
github:
development:
clientId: ${GITHUB_APP_CLIENT_ID}
Expand Down
23 changes: 22 additions & 1 deletion backstage/packages/app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { createApp } from '@backstage/app-defaults';
import { AppRouter, FlatRoutes } from '@backstage/core-app-api';
import { AlertDisplay, OAuthRequestDialog } from '@backstage/core-components';
import {
AlertDisplay,
OAuthRequestDialog,
SignInPage,
} from '@backstage/core-components';
import { githubAuthApiRef } from '@backstage/core-plugin-api';
import { apiDocsPlugin } from '@backstage/plugin-api-docs';
import {
CatalogEntityPage,
Expand Down Expand Up @@ -39,6 +44,22 @@ import { searchPage } from './components/search/SearchPage';
import { PrefixNavigate } from './components/utils/PrefixNavigate';

const app = createApp({
components: {
SignInPage: props => (
<SignInPage
{...props}
providers={[
'guest',
{
id: 'github-auth-provider',
title: 'GitHub',
message: 'Sign in using GitHub',
apiRef: githubAuthApiRef,
},
]}
/>
),
},
apis,
bindRoutes({ bind }) {
bind(catalogPlugin.externalRoutes, {
Expand Down
2 changes: 2 additions & 0 deletions backstage/packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"@backstage/config": "^1.3.2",
"@backstage/integration": "^1.16.1",
"@backstage/plugin-auth-backend": "^0.24.2",
"@backstage/plugin-auth-backend-module-github-provider": "^0.2.4",
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.4",
"@backstage/plugin-auth-node": "^0.5.6",
"@backstage/plugin-catalog-backend": "^1.30.0",
"@backstage/plugin-catalog-backend-module-github": "^0.7.9",
Expand Down
4 changes: 3 additions & 1 deletion backstage/packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
} from '@immobiliarelabs/backstage-plugin-gitlab-backend';

const backend = createBackend();
backend.add(legacyPlugin('auth', import('./plugins/auth')));
backend.add(import('@backstage/plugin-auth-backend'));
backend.add(import('@backstage/plugin-auth-backend-module-github-provider'));
backend.add(import('@backstage/plugin-auth-backend-module-guest-provider'));

// Catalog with Scaffolder module
backend.add(import('@backstage/plugin-catalog-backend'));
Expand Down
54 changes: 0 additions & 54 deletions backstage/packages/backend/src/plugins/auth.ts

This file was deleted.

35 changes: 22 additions & 13 deletions backstage/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3659,6 +3659,17 @@
google-auth-library "^9.0.0"
passport-google-oauth20 "^2.0.0"

"@backstage/plugin-auth-backend-module-guest-provider@^0.2.4":
version "0.2.4"
resolved "https://registry.yarnpkg.com/@backstage/plugin-auth-backend-module-guest-provider/-/plugin-auth-backend-module-guest-provider-0.2.4.tgz#1cb5ed34af636fccb0c712ea3d53636f7065f458"
integrity sha512-UVFsNwh0E+VBjDOhioIpf6tewQu8KffDpFEPUxpVBkyyc3YMhdNEmfhfiK8G9vE2L6VGAgdKDq8DfPDD1vspyg==
dependencies:
"@backstage/backend-plugin-api" "^1.1.1"
"@backstage/catalog-model" "^1.7.3"
"@backstage/errors" "^1.2.7"
"@backstage/plugin-auth-node" "^0.5.6"
passport-oauth2 "^1.7.0"

"@backstage/plugin-auth-backend-module-microsoft-provider@^0.2.4":
version "0.2.4"
resolved "https://registry.yarnpkg.com/@backstage/plugin-auth-backend-module-microsoft-provider/-/plugin-auth-backend-module-microsoft-provider-0.2.4.tgz#ed4a11aa107ce5646f24484fcea5c6b2c84d6706"
Expand Down Expand Up @@ -11112,12 +11123,10 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb"
integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==

"@types/react-dom@*", "@types/react-dom@<18.0.0":
version "17.0.25"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.25.tgz#e0e5b3571e1069625b3a3da2b279379aa33a0cb5"
integrity sha512-urx7A7UxkZQmThYA4So0NelOVjx3V4rNFVJwp0WZlbIK5eM4rNJDiN3R/E9ix0MBh6kAEojk/9YL+Te6D9zHNA==
dependencies:
"@types/react" "^17"
"@types/react-dom@*", "@types/react-dom@<18.0.0", "@types/react-dom@^17":
version "17.0.26"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.26.tgz#fa7891ba70fd39ddbaa7e85b6ff9175bb546bc1b"
integrity sha512-Z+2VcYXJwOqQ79HreLU/1fyQ88eXSSFh6I3JdrEHQIfYSI0kCQpTGvOrbE6jFGGYXKsHuwY9tBa/w5Uo6KzrEg==

"@types/react-redux@^7.1.20":
version "7.1.33"
Expand All @@ -11144,12 +11153,12 @@
"@types/react" "*"

"@types/react@*", "@types/react@^16.13.1 || ^17.0.0 || ^18.0.0", "@types/react@^17":
version "17.0.76"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.76.tgz#bfdf762046699e265655cd8f67a51beab6cd1e80"
integrity sha512-w9Aq+qeszGYoQM0hgFcdsAODGJdogadBDiitPm+zjBFJ0mLymvn2qSXsDaLJUndFRqqXk1FQfa9avHUBk1JhJQ==
version "17.0.83"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.83.tgz#b477c56387b74279281149dcf5ba2a1e2216d131"
integrity sha512-l0m4ArKJvmFtR4e8UmKrj1pB4tUgOhJITf+mADyF/p69Ts1YAR/E+G9XEM0mHXKVRa1dQNHseyyDNzeuAXfXQw==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
"@types/scheduler" "^0.16"
csstype "^3.0.2"

"@types/request@^2.47.1", "@types/request@^2.48.8":
Expand All @@ -11172,7 +11181,7 @@
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.2.tgz#ed279a64fa438bb69f2480eda44937912bb7480a"
integrity sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==

"@types/scheduler@*":
"@types/scheduler@^0.16":
version "0.16.8"
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.8.tgz#ce5ace04cfeabe7ef87c0091e50752e36707deff"
integrity sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==
Expand Down Expand Up @@ -23486,7 +23495,7 @@ [email protected]:
uid2 "0.0.x"
utils-merge "1.x.x"

[email protected], passport-oauth2@^1.1.2, passport-oauth2@^1.4.0, passport-oauth2@^1.6.0, passport-oauth2@^1.6.1:
[email protected], passport-oauth2@^1.1.2, passport-oauth2@^1.4.0, passport-oauth2@^1.6.0, passport-oauth2@^1.6.1, passport-oauth2@^1.7.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/passport-oauth2/-/passport-oauth2-1.8.0.tgz#55725771d160f09bbb191828d5e3d559eee079c8"
integrity sha512-cjsQbOrXIDE4P8nNb3FQRCCmJJ/utnFKEz2NX209f7KOHPoX18gF7gBzBbLLsj2/je4KrgiwLLGjf0lm9rtTBA==
Expand Down Expand Up @@ -27233,7 +27242,7 @@ swagger-client@^3.24.6:
qs "^6.10.2"
traverse "~0.6.6"

swagger-ui-react@^5.0.0:
swagger-ui-react@<5.11.0, swagger-ui-react@^5.0.0:
version "5.10.5"
resolved "https://registry.yarnpkg.com/swagger-ui-react/-/swagger-ui-react-5.10.5.tgz#a9da3c452599530b1df4e1c7860c2888f683c617"
integrity sha512-uBQLku4j3L1NC4/xE3HTgz1EcFisBphh8AnGqbj9LMxeGGcpKOlx/ZDigRAeVXWr9jOnZZbeGBzMe4NVHxPZrQ==
Expand Down

0 comments on commit 45cc39c

Please sign in to comment.