parent
96c01b2fa0
commit
e234bc0d24
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 = {
|
const authConfig: AuthenticationConfig = {
|
||||||
storage: ORMUserRepository,
|
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
|
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 {Route, SessionAuthMiddleware, AuthRequiredMiddleware} from '@extollo/lib'
|
||||||
import {Home} from "../controllers/main/Home.controller";
|
import {Home} from '../controllers/main/Home.controller'
|
||||||
import {AuthRequiredMiddleware} from "@extollo/lib/lib/auth/middleware/AuthRequiredMiddleware";
|
|
||||||
|
|
||||||
Route.group('/', () => {
|
Route.group('/', () => {
|
||||||
Route.get('/')
|
Route.get('/')
|
||||||
.calls<Home>(Home, home => home.welcome)
|
.calls<Home>(Home, home => home.welcome)
|
||||||
|
})
|
||||||
|
|
||||||
|
Route.group('', () => {
|
||||||
Route.get('/dash')
|
Route.get('/dash')
|
||||||
.pre(AuthRequiredMiddleware)
|
.pre(AuthRequiredMiddleware)
|
||||||
.calls<Home>(Home, home => home.welcome)
|
.calls<Home>(Home, home => home.welcome)
|
||||||
})
|
}).pre(SessionAuthMiddleware)
|
||||||
|
|
||||||
// BasicLoginController.routes()
|
|
||||||
|
Loading…
Reference in new issue