Search in sources :

Example 1 with IAuthService

use of com.pogeyan.cmis.api.auth.IAuthService in project copper-cms by PogeyanOSS.

the class LoginActor method authenticate.

private LoginResponse authenticate(LoginRequest t, HashMap<String, Object> baggage) {
    LoginResponse response = new LoginResponse();
    try {
        Map<String, String> loginSettings = RepositoryManagerFactory.getLoginDetails(t.getRepositoryId());
        if (LOG.isDebugEnabled()) {
            LOG.debug("Login settings for repositoryId: {}", loginSettings.toString());
        }
        IAuthService authService = LoginAuthServiceFactory.createAuthService(loginSettings);
        if (authService != null) {
            LoginRequestObject loginObject = new LoginRequestObject(t.getHeaders().get("authorization"), t.getRepositoryId());
            IUserObject result = authService.authenticate(loginObject);
            response.setSuccessfulLogin(result != null);
            response.setLoginDetails(result);
        } else {
            LOG.error("Login authenticate service not found for: {}", loginSettings.toString());
            response.setSuccessfulLogin(false);
        }
    } catch (Exception e) {
        LOG.error("Login authenticate error: {}", ExceptionUtils.getStackTrace(e));
        response.setSuccessfulLogin(false);
    }
    return response;
}
Also used : LoginResponse(com.pogeyan.cmis.api.messages.LoginResponse) LoginRequestObject(com.pogeyan.cmis.api.auth.LoginRequestObject) IAuthService(com.pogeyan.cmis.api.auth.IAuthService) IUserObject(com.pogeyan.cmis.api.auth.IUserObject)

Aggregations

IAuthService (com.pogeyan.cmis.api.auth.IAuthService)1 IUserObject (com.pogeyan.cmis.api.auth.IUserObject)1 LoginRequestObject (com.pogeyan.cmis.api.auth.LoginRequestObject)1 LoginResponse (com.pogeyan.cmis.api.messages.LoginResponse)1