dh_ackergaul
vor 3 Tagen 5bbf43c1b146439ab882815c12ed6292f1d7b4df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
 * AuthenticationController.js
 *
 * This controller handles login
 */
 
 
const { OpusAuthenticationService } = require("../services/OpusAuthenticationService");
const { OAuth2AuthenticationService } = require("../services/OAuth2AuthenticationService");
 
let authenticationService;
 
if (sails.config.oauth && sails.config.oauth.useNewAuthentication === true) {
    authenticationService = new OAuth2AuthenticationService();
}
else {
    authenticationService = new OpusAuthenticationService();
}
 
module.exports = {
 
    /**
     * Login page
     *
     * GET /auth/login
     */
    login: function (req, res) {
        return authenticationService.login(req, res);
    },
 
    /**
     * Login form
     *
     * POST /auth/login
     */
    login_form: function (req, res) {
        return authenticationService.login_form(req, res);
    },
 
    /**
     * Logout
     *
     * POST /auth/logout
     */
    logout: function (req, res) {
        return authenticationService.logout(req, res);
    },
 
    /**
     * OAuth Login Callback
     *
     * GET /auth/login/callback
     */
    callback(req, res) {
        return authenticationService.callback(req, res);
    },
 
    /**
     * OAuth Logout Callback
     *
     * POST /auth/logout/back-channel
     */
    backchannelLogout(req, res) {
        return authenticationService.backchannelLogout(req, res);
    }
};