@backstage/plugin-auth-backend 0.13.1-next.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import { Config } from '@backstage/config';
7
7
  import { BackstageSignInResult, BackstageIdentityResponse } from '@backstage/plugin-auth-node';
8
8
  import { Profile } from 'passport';
9
9
  import { UserEntity, Entity } from '@backstage/catalog-model';
10
+ import { IncomingHttpHeaders } from 'http';
10
11
  import { TokenSet, UserinfoResponse } from 'openid-client';
11
12
  import { JsonValue } from '@backstage/types';
12
13
 
@@ -472,7 +473,6 @@ declare class OAuthEnvironmentHandler implements AuthProviderRouteHandlers {
472
473
  declare type Options = {
473
474
  providerId: string;
474
475
  secure: boolean;
475
- disableRefresh?: boolean;
476
476
  persistScopes?: boolean;
477
477
  cookieDomain: string;
478
478
  cookiePath: string;
@@ -485,7 +485,7 @@ declare type Options = {
485
485
  declare class OAuthAdapter implements AuthProviderRouteHandlers {
486
486
  private readonly handlers;
487
487
  private readonly options;
488
- static fromConfig(config: AuthProviderConfig, handlers: OAuthHandlers, options: Pick<Options, 'providerId' | 'persistScopes' | 'disableRefresh' | 'tokenIssuer' | 'callbackUrl'>): OAuthAdapter;
488
+ static fromConfig(config: AuthProviderConfig, handlers: OAuthHandlers, options: Pick<Options, 'providerId' | 'persistScopes' | 'tokenIssuer' | 'callbackUrl'>): OAuthAdapter;
489
489
  private readonly baseCookieOptions;
490
490
  constructor(handlers: OAuthHandlers, options: Options);
491
491
  start(req: express.Request, res: express.Response): Promise<void>;
@@ -973,15 +973,38 @@ declare const createOAuth2Provider: (options?: {
973
973
  *
974
974
  * @public
975
975
  */
976
- declare type OAuth2ProxyResult<JWTPayload> = {
976
+ declare type OAuth2ProxyResult<JWTPayload = {}> = {
977
977
  /**
978
- * Parsed and decoded JWT payload.
978
+ * The parsed payload of the `accessToken`. The token is only parsed, not verified.
979
+ *
980
+ * @deprecated Access through the `headers` instead. This will be removed in a future release.
979
981
  */
980
982
  fullProfile: JWTPayload;
981
983
  /**
982
- * Raw JWT token
984
+ * The token received via the X-OAUTH2-PROXY-ID-TOKEN header. Will be an empty string
985
+ * if the header is not set. Note the this is typically an OpenID Connect token.
986
+ *
987
+ * @deprecated Access through the `headers` instead. This will be removed in a future release.
983
988
  */
984
989
  accessToken: string;
990
+ /**
991
+ * The headers of the incoming request from the OAuth2 proxy. This will include
992
+ * both the headers set by the client as well as the ones added by the OAuth2 proxy.
993
+ * You should only trust the headers that are injected by the OAuth2 proxy.
994
+ *
995
+ * Useful headers to use to complete the sign-in are for example `x-forwarded-user`
996
+ * and `x-forwarded-email`. See the OAuth2 proxy documentation for more information
997
+ * about the available headers and how to enable them. In particular it is possible
998
+ * to forward access and identity tokens, which can be user for additional verification
999
+ * and lookups.
1000
+ */
1001
+ headers: IncomingHttpHeaders;
1002
+ /**
1003
+ * Provides convenient access to the request headers.
1004
+ *
1005
+ * This call is simply forwarded to `req.get(name)`.
1006
+ */
1007
+ getHeader(name: string): string | undefined;
985
1008
  };
986
1009
  /**
987
1010
  * @public
@@ -1009,8 +1032,12 @@ declare type Oauth2ProxyProviderOptions<JWTPayload> = {
1009
1032
  declare const createOauth2ProxyProvider: (options: {
1010
1033
  /**
1011
1034
  * Configure an auth handler to generate a profile for the user.
1035
+ *
1036
+ * The default implementation uses the value of the `X-Forwarded-Preferred-Username`
1037
+ * header as the display name, falling back to `X-Forwarded-User`, and the value of
1038
+ * the `X-Forwarded-Email` header as the email address.
1012
1039
  */
1013
- authHandler: AuthHandler<OAuth2ProxyResult<unknown>>;
1040
+ authHandler?: AuthHandler<OAuth2ProxyResult<unknown>> | undefined;
1014
1041
  /**
1015
1042
  * Configure sign-in for this provider, without it the provider can not be used to sign users in.
1016
1043
  */
@@ -1377,7 +1404,7 @@ declare const providers: Readonly<{
1377
1404
  }>;
1378
1405
  oauth2Proxy: Readonly<{
1379
1406
  create: (options: {
1380
- authHandler: AuthHandler<OAuth2ProxyResult<unknown>>;
1407
+ authHandler?: AuthHandler<OAuth2ProxyResult<unknown>> | undefined;
1381
1408
  signIn: {
1382
1409
  resolver: SignInResolver<OAuth2ProxyResult<unknown>>;
1383
1410
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-auth-backend",
3
3
  "description": "A Backstage backend plugin that handles authentication",
4
- "version": "0.13.1-next.0",
4
+ "version": "0.14.0",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -33,12 +33,12 @@
33
33
  "clean": "backstage-cli package clean"
34
34
  },
35
35
  "dependencies": {
36
- "@backstage/backend-common": "^0.13.3-next.0",
37
- "@backstage/catalog-client": "^1.0.1",
38
- "@backstage/catalog-model": "^1.0.1",
39
- "@backstage/config": "^1.0.0",
36
+ "@backstage/backend-common": "^0.13.3",
37
+ "@backstage/catalog-client": "^1.0.2",
38
+ "@backstage/catalog-model": "^1.0.2",
39
+ "@backstage/config": "^1.0.1",
40
40
  "@backstage/errors": "^1.0.0",
41
- "@backstage/plugin-auth-node": "^0.2.1-next.0",
41
+ "@backstage/plugin-auth-node": "^0.2.1",
42
42
  "@backstage/types": "^1.0.0",
43
43
  "@google-cloud/firestore": "^5.0.2",
44
44
  "@types/express": "^4.17.6",
@@ -76,8 +76,8 @@
76
76
  "yn": "^4.0.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@backstage/backend-test-utils": "^0.1.24-next.0",
80
- "@backstage/cli": "^0.17.1-next.0",
79
+ "@backstage/backend-test-utils": "^0.1.24",
80
+ "@backstage/cli": "^0.17.1",
81
81
  "@types/body-parser": "^1.19.0",
82
82
  "@types/cookie-parser": "^1.4.2",
83
83
  "@types/express-session": "^1.17.2",
@@ -97,5 +97,5 @@
97
97
  "config.d.ts"
98
98
  ],
99
99
  "configSchema": "config.d.ts",
100
- "gitHead": "88ee375f5ee44b7a7917297785ddf88691fe3381"
100
+ "gitHead": "96323f280ba32ee526c5b151cda42260aee927c9"
101
101
  }