Skip to content

Commit 3270eba

Browse files
committed
refactor(service): users/auth: add todo note
1 parent 484b3ec commit 3270eba

File tree

1 file changed

+1
-38
lines changed

1 file changed

+1
-38
lines changed

service/src/ingress/index.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,9 @@ const authenticationApiAppender = require('../utilities/authenticationApiAppende
1515
const AuthenticationConfiguration = require('../models/authenticationconfiguration')
1616
const SecurePropertyAppender = require('../security/utilities/secure-property-appender');
1717

18-
1918
/**
20-
* Register the route to generate an API access token, the final step in the ingress process after enrollment,
21-
* authentication. This step includes provisioning a device based on the configured policy.
19+
* TODO: users-next: this module should go away. this remains for now as a reference to migrate legacy logic to new architecture
2220
*/
23-
function registerDeviceVerificationAndTokenGenerationEndpoint(routes: express.Router, passport: passport.Authenticator, deviceProvisioning: ProvisionStatic, sessionRepo: SessionRepository) {
24-
routes.post('/auth/token',
25-
passport.authenticate(VerifyIdpAuthenticationToken),
26-
async (req, res, next) => {
27-
deviceProvisioning.check()
28-
const options = {
29-
userAgent: req.headers['user-agent'],
30-
appVersion: req.body.appVersion
31-
}
32-
// TODO: users-next
33-
new api.User().login(req.user, req.provisionedDevice, options, function (err, session) {
34-
if (err) return next(err);
35-
36-
authenticationApiAppender.append(config.api).then(api => {
37-
res.json({
38-
token: session.token,
39-
expirationDate: session.expirationDate,
40-
user: userTransformer.transform(req.user, { path: req.getRoot() }),
41-
device: req.provisionedDevice,
42-
api: api
43-
});
44-
}).catch(err => {
45-
next(err);
46-
});
47-
});
48-
49-
req.session = null;
50-
}
51-
);
52-
}
53-
54-
function registerLocalAuthenticationProtocol(): void {
55-
56-
}
57-
5821

5922
export class AuthenticationInitializer {
6023
static tokenService = new JWTService(crypto.randomBytes(64).toString('hex'), 'urn:mage');

0 commit comments

Comments
 (0)