Skip to content

feat: remove auth #598

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

Merged
merged 4 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,049 changes: 1,025 additions & 1,024 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@
"@adobe/helix-shared-utils": "3.0.2",
"@adobe/mdast-util-gridtables": "4.0.4",
"@adobe/remark-gridtables": "3.0.4",
"cookie": "0.6.0",
"github-slugger": "2.0.0",
"hast-util-raw": "9.0.3",
"hast-util-select": "6.0.2",
"hast-util-to-html": "9.0.1",
"hast-util-to-string": "3.0.0",
"hastscript": "9.0.0",
"jose": "5.3.0",
"lodash.escape": "4.0.1",
"mdast-util-to-hast": "13.1.0",
"mdast-util-to-string": "4.0.0",
Expand Down
31 changes: 1 addition & 30 deletions src/PipelineState.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* OF ANY KIND; either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {PathInfo, S3Loader, FormsMessageDispatcher, PipelineTimer, AuthEnvLoader } from "./index";
import {PathInfo, S3Loader, PipelineTimer } from "./index";
import {PipelineContent} from "./PipelineContent";
import {PipelineSiteConfig} from "./site-config";

Expand All @@ -21,21 +21,9 @@ declare enum PipelineType {

type Fetch = (url: string|Request, options?: RequestOptions) => Promise<Response>;

declare interface AccessConfig {
allow:(string|string[]);

apiKeyId:(string|string[]);

require: {
repository:(string|string[]);
};
}

declare interface PipelineOptions {
log: Console;
s3Loader: S3Loader;
messageDispatcher: FormsMessageDispatcher;
authEnvLoader: AuthEnvLoader;
config: PipelineSiteConfig;
fetch: Fetch;
ref: string;
Expand All @@ -55,16 +43,8 @@ declare class PipelineState {
content: PipelineContent;
contentBusId: string;
s3Loader: S3Loader;
messageDispatcher: FormsMessageDispatcher;
authEnvLoader: AuthEnvLoader;
fetch: Fetch;

/**
* Returns the external link representation for authentication related redirects and cookies.
* This is only used for local testing and is an identity operation in production.
*/
createExternalLocation(value:string): string;

/**
* Content bus partition
* @example 'live'
Expand Down Expand Up @@ -122,11 +102,6 @@ declare class PipelineState {
*/
type: PipelineType;

/**
* Authentication information
*/
authInfo?: AuthInfo;

/**
* the production host
*/
Expand All @@ -142,9 +117,5 @@ declare class PipelineState {
*/
liveHost: string;

/**
* used for development server to include RSO information in the auth state
*/
authIncludeRSO: boolean;
}

7 changes: 0 additions & 7 deletions src/PipelineState.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ export class PipelineState {
metadata: Modifiers.EMPTY,
headers: Modifiers.EMPTY,
s3Loader: opts.s3Loader,
messageDispatcher: opts.messageDispatcher,
authEnvLoader: opts.authEnvLoader ?? { load: () => {} },
fetch: opts.fetch,
timer: opts.timer,
type: 'html',
Expand All @@ -52,9 +50,4 @@ export class PipelineState {
}
}
}

// eslint-disable-next-line class-methods-use-this
createExternalLocation(value) {
return value;
}
}
46 changes: 0 additions & 46 deletions src/auth-pipe.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/html-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* governing permissions and limitations under the License.
*/
import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
import { authenticate } from './steps/authenticate.js';
import addHeadingIds from './steps/add-heading-ids.js';
import createPageBlocks from './steps/create-page-blocks.js';
import createPictures from './steps/create-pictures.js';
Expand Down Expand Up @@ -135,11 +134,6 @@ export async function htmlPipe(state, req) {
fetchMappedMetadata(state),
]);

// await requireProject(state, req, res);
if (res.error !== 401) {
await authenticate(state, req, res);
}

if (res.error) {
// if content loading produced an error, we're done.
const level = res.status >= 500 ? 'error' : 'info';
Expand Down
18 changes: 0 additions & 18 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,11 @@ export declare interface S3Loader {
headObject(bucketId, key): Promise<PipelineResponse>;
}

export declare interface AuthEnvLoader {

/**
* loads (secret) parameters needed for authentication. The parameters are added to the
* `state.env` object.
* @return {Promise<void>}
*/
load(state:PipelineState):Promise<void>;
}

export declare interface DispatchMessageResponse {
messageId:string,
requestId:string,
}

export declare interface FormsMessageDispatcher {
/**
* Dispatches the message to the forms queue
* @param {object} message
*/
dispatch(message:object): Promise<DispatchMessageResponse>;
}

/**
* Timer
*/
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/
export * from './html-pipe.js';
export * from './json-pipe.js';
export * from './auth-pipe.js';
export * from './options-pipe.js';
export * from './robots-pipe.js';
export * from './sitemap-pipe.js';
Expand Down
3 changes: 0 additions & 3 deletions src/json-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import setCustomResponseHeaders from './steps/set-custom-response-headers.js';
import { PipelineResponse } from './PipelineResponse.js';
import jsonFilter from './utils/json-filter.js';
import { extractLastModified, updateLastModified } from './utils/last-modified.js';
import { authenticate } from './steps/authenticate.js';
import { getPathInfo } from './utils/path.js';
import { PipelineStatusError } from './PipelineStatusError.js';

Expand Down Expand Up @@ -150,8 +149,6 @@ export async function jsonPipe(state, req) {

state.timer?.update('json-metadata-fetch');

await authenticate(state, req, res);

if (res.status === 404 && state.info.path === '/config.json' && state.config.public) {
// special handling for public config
const publicConfig = {
Expand Down
129 changes: 0 additions & 129 deletions src/steps/authenticate.js

This file was deleted.

41 changes: 0 additions & 41 deletions src/utils/auth-cookie.js

This file was deleted.

Loading