Update template to match latest lib and cc

master
Garrett Mills 2 years ago
parent 96c01b2fa0
commit e234bc0d24

@ -8,14 +8,18 @@
"lib": "lib"
},
"dependencies": {
"@extollo/lib": "^0.3.1",
"@extollo/lib": "^0.9.0",
"copyfiles": "^2.4.1",
"typescript": "^4.1.3"
"rimraf": "^3.0.2",
"ts-expose-internals": "^4.5.4",
"ts-patch": "^2.0.1",
"ts-to-zod": "^1.8.0",
"typescript": "^4.3.2",
"zod": "^3.11.6"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rm -rf lib && mkdir -p lib && cp .env lib/.env && tsc",
"postbuild": "copyfiles -u 1 src/app/resources/**/* lib",
"build": "excc -c package.json -t tsconfig.json",
"app": "pnpm run build && node lib/index.js",
"cli": "pnpm run build && node lib/cli.js"
},
@ -29,5 +33,19 @@
"url": "https://code.garrettmills.dev/extollo/extollo"
},
"author": "garrettmills <shout@garrettmills.dev>",
"license": "MIT"
"license": "MIT",
"extollo": {
"cc": {
"zodify": [
"src/app/types"
],
"non-source": [
".env",
"src/app/resources"
]
}
},
"devDependencies": {
"@extollo/cc": "^0.6.0"
}
}

File diff suppressed because it is too large Load Diff

@ -1,7 +1,21 @@
import {AuthenticationConfig, ORMUserRepository} from '@extollo/lib'
import {AuthenticationConfig, CoreIDLoginProvider, OAuth2LoginProviderConfig, ORMUserRepository, env} from '@extollo/lib'
const authConfig: AuthenticationConfig = {
storage: ORMUserRepository,
providers: {
coreid: {
driver: CoreIDLoginProvider,
config: {
default: true,
displayName: 'Starship CoreID',
clientId: env('COREID_CLIENT_ID'),
clientSecret: env('COREID_CLIENT_SECRET'),
loginUrl: env('COREID_BASE', '') + '/auth/service/oauth2/authorize?client_id=%c&redirect_uri=%r',
tokenUrl: env('COREID_BASE', '') + '/auth/service/oauth2/redeem',
userUrl: env('COREID_BASE', '') + '/api/v1/auth/users/me',
} as OAuth2LoginProviderConfig,
}
},
}
export default authConfig

@ -0,0 +1,24 @@
import {OAuth2Client, OAuth2Scope, env, /*uuid4*/} from '@extollo/lib'
export default {
secret: env('OAUTH2_SECRET'),
scopes: {
'user-info': {
id: 'user-info',
name: 'user-info',
description: 'access basic information about your account',
},
} as {[key: string]: OAuth2Scope},
clients: {
// 'test-1': {
// id: 'test-1',
// display: 'Test 1',
// secret: env('TEST_CLIENT_SECRET', uuid4()),
// allowedFlows: ['code'],
// allowedScopeIds: ['user-info'],
// allowedRedirectUris: [
// 'http://localhost:1234/callback',
// ],
// },
} as {[key: string]: OAuth2Client},
}

@ -1,14 +1,13 @@
import {Route} from '@extollo/lib'
import {Home} from "../controllers/main/Home.controller";
import {AuthRequiredMiddleware} from "@extollo/lib/lib/auth/middleware/AuthRequiredMiddleware";
import {Route, SessionAuthMiddleware, AuthRequiredMiddleware} from '@extollo/lib'
import {Home} from '../controllers/main/Home.controller'
Route.group('/', () => {
Route.get('/')
.calls<Home>(Home, home => home.welcome)
})
Route.group('', () => {
Route.get('/dash')
.pre(AuthRequiredMiddleware)
.calls<Home>(Home, home => home.welcome)
})
// BasicLoginController.routes()
}).pre(SessionAuthMiddleware)

Loading…
Cancel
Save