@functionalcms/svelte-components 2.20.0 → 2.20.2
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {} from '@sveltejs/kit';
|
|
2
2
|
import { createSession, getSession, deleteSession } from './sessionStorage.js';
|
|
3
3
|
const authSessionCookieName = `auth_session`;
|
|
4
|
-
const logout = (cookies, afterLogoutPath = '/') => {
|
|
4
|
+
const logout = async (cookies, afterLogoutPath = '/') => {
|
|
5
5
|
const headers = new Headers();
|
|
6
6
|
const state = cookies.get(authSessionCookieName);
|
|
7
7
|
if (state) {
|
|
@@ -26,7 +26,8 @@ const createUserSession = async (provider, event) => {
|
|
|
26
26
|
event.locals.accessToken = token.access_token;
|
|
27
27
|
const sessionId = createSession({ session, token }, token.expires_in);
|
|
28
28
|
headers.append('Location', provider.redirectPath);
|
|
29
|
-
headers.append('Set-Cookie', `${authSessionCookieName}=${sessionId}; HttpOnly; Secure; SameSite=Lax; Max-Age
|
|
29
|
+
headers.append('Set-Cookie', `${authSessionCookieName}=${sessionId}; HttpOnly; Secure; SameSite=Lax; Max-Age=3600; Path=/`);
|
|
30
|
+
// `${authSessionCookieName}=${sessionId}; HttpOnly; Secure; SameSite=Lax; Max-Age=${token.expires_in}; Path=/`);
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
33
|
headers.append('Location', '/');
|
|
@@ -52,7 +53,8 @@ export const authenticationHandle = (provider) => {
|
|
|
52
53
|
}
|
|
53
54
|
//logout
|
|
54
55
|
if (event.url.pathname === '/auth/logout') {
|
|
55
|
-
|
|
56
|
+
// await provider.logout();
|
|
57
|
+
const headers = await logout(event.cookies);
|
|
56
58
|
return new Response('Logging Out...', { status: 303, headers });
|
|
57
59
|
}
|
|
58
60
|
// login
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Token } from './types.js';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const machineAuthenticationProvider: (scope?: string, redirectPath?: string) => {
|
|
3
3
|
getAuthIdentity: (domain: string) => Promise<any>;
|
|
4
4
|
getValidation: (event: any) => Promise<Token>;
|
|
5
5
|
getUser: (token: Token) => Promise<any>;
|
|
@@ -64,7 +64,7 @@ const getUser = async (issuer, token) => {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
export const
|
|
67
|
+
export const machineAuthenticationProvider = (scope = '', redirectPath = '/') => {
|
|
68
68
|
const extendedScope = `openid profile offline_access ${scope}`;
|
|
69
69
|
const redirectUrl = "/auth/validate";
|
|
70
70
|
return {
|
package/dist/index-server.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { authenticationHandle } from './auth/authenticationHandle.js';
|
|
2
2
|
import authorizationHandle from './auth/authorizationHandle.js';
|
|
3
3
|
import errorHandler from './auth/errorHandle.js';
|
|
4
|
+
import { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.js';
|
|
5
|
+
import { userAuthenticationProvider } from './auth/userAuthenticationProvider.js';
|
|
4
6
|
import { getBlobService, getCommunicationService, getDataService, getTemplateService, getWebsiteService } from './server-side/getServices.js';
|
|
5
|
-
export { authenticationHandle, authorizationHandle, errorHandler, getDataService, getCommunicationService, getWebsiteService, getTemplateService, getBlobService };
|
|
7
|
+
export { authenticationHandle, authorizationHandle, errorHandler, machineAuthenticationProvider, userAuthenticationProvider, getDataService, getCommunicationService, getWebsiteService, getTemplateService, getBlobService };
|
package/dist/index-server.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { authenticationHandle } from './auth/authenticationHandle.js';
|
|
2
2
|
import authorizationHandle from './auth/authorizationHandle.js';
|
|
3
3
|
import errorHandler from './auth/errorHandle.js';
|
|
4
|
+
import { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.js';
|
|
5
|
+
import { userAuthenticationProvider } from './auth/userAuthenticationProvider.js';
|
|
4
6
|
import { getBlobService, getCommunicationService, getDataService, getTemplateService, getWebsiteService } from './server-side/getServices.js';
|
|
5
|
-
export { authenticationHandle, authorizationHandle, errorHandler, getDataService, getCommunicationService, getWebsiteService, getTemplateService, getBlobService };
|
|
7
|
+
export { authenticationHandle, authorizationHandle, errorHandler, machineAuthenticationProvider, userAuthenticationProvider, getDataService, getCommunicationService, getWebsiteService, getTemplateService, getBlobService };
|