Tabnine Logo
AuthenticationService
Code IndexAdd Tabnine to your IDE (free)

How to use
AuthenticationService
in
com.haulmont.cuba.security.auth

Best Java code snippets using com.haulmont.cuba.security.auth.AuthenticationService (Showing top 20 results out of 315)

origin: com.haulmont.cuba/cuba-core

@Override
public void logout() {
  authenticationService.logout();
}
origin: com.haulmont.cuba/cuba-portal

protected AuthenticationDetails loginMiddleware(LoginPasswordCredentials credentials) throws LoginException {
  return authenticationService.login(credentials);
}
origin: com.haulmont.cuba/cuba-core

@Override
public UserSession substituteUser(User substitutedUser) {
  return authenticationService.substituteUser(substitutedUser);
}
origin: com.haulmont.cuba/cuba-rest-api

try {
  AbstractClientCredentials credentials = new LoginPasswordCredentials(username, password, locale);
  UserSession userSession = authenticationService.login(credentials).getSession();
    AppContext.setSecurityContext(new SecurityContext(userSession));
    try {
      authenticationService.logout();
    } finally {
      AppContext.setSecurityContext(null);
origin: com.haulmont.cuba/cuba-global

        UserSession session = authenticationService.login(credentials).getSession();
        AppContext.setSecurityContext(new SecurityContext(session));
        logoutRequired = true;
if (logoutRequired) {
  try {
    authenticationService.logout();
  } finally {
    AppContext.setSecurityContext(null);
origin: com.haulmont.cuba/cuba-rest-api

protected AuthenticationDetails loginMiddleware(LoginPasswordCredentials credentials) throws LoginException {
  return authenticationService.login(credentials);
}
origin: com.haulmont.cuba/cuba-rest-api

  protected void doLogout(String sessionUUID, HttpServletResponse response) throws IOException, JSONException {
    try {
      if (authentication.begin(sessionUUID)) {
        AuthenticationService authenticationService = AppBeans.get(AuthenticationService.NAME);
        authenticationService.logout();
      }
    } catch (Throwable e) {
      log.error("Error processing logout request", e);
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
  }
}
origin: com.haulmont.cuba/cuba-web

@Override
public void substituteUser(User substitutedUser) {
  UserSession previousSession = getSession();
  UserSession session = authenticationService.substituteUser(substitutedUser);
  ClientUserSession clientUserSession = createSession(session);
  clientUserSession.setAuthenticated(true);
  setSessionInternal(clientUserSession);
  publishUserSessionSubstitutedEvent(previousSession, clientUserSession);
  fireSubstitutionListeners();
}
origin: com.haulmont.cuba/cuba-web

protected AuthenticationDetails loginMiddleware(Credentials credentials) throws LoginException {
  return authenticationService.login(credentials);
}
origin: com.haulmont.cuba/cuba-portal

@Override
public synchronized void logout() {
  try {
    authenticationService.logout();
    AppContext.setSecurityContext(null);
  } catch (Exception e) {
    log.warn("Error on logout", e);
  }
  connected = false;
  try {
    fireConnectionListeners();
  } catch (LoginException e) {
    log.warn("Error on logout", e);
  }
  session = null;
}
origin: com.haulmont.cuba/cuba-web

protected AuthenticationDetails loginMiddleware(TrustedClientCredentials credentials) throws LoginException {
  return authenticationService.login(credentials);
}
origin: com.haulmont.cuba/cuba-portal

protected void internalLogout() {
  if (session != null && session.isAuthenticated()) {
    authenticationService.logout();
  }
  AppContext.setSecurityContext(null);
  connected = false;
  session = null;
}
origin: com.haulmont.cuba/cuba-web

protected AuthenticationDetails loginMiddleware(LoginPasswordCredentials credentials) throws LoginException {
  return authenticationService.login(credentials);
}
origin: com.haulmont.cuba/cuba-web-auth

authenticationService.logout();
origin: com.haulmont.cuba/cuba-web

@Nullable
@Override
public AuthenticationDetails login(Credentials credentials) throws LoginException {
  if (!(credentials instanceof RememberMeCredentials)) {
    throw new ClassCastException("Credentials cannot be cast to RememberMeCredentials");
  }
  return authenticationService.login(credentials);
}
origin: com.haulmont.cuba/cuba-web

@Override
public void logout() {
  backgroundWorker.checkUIAccess();
  ClientUserSession session = getSessionInternal();
  if (session == null) {
    throw new IllegalStateException("There is no active session");
  }
  if (!session.isAuthenticated()) {
    throw new IllegalStateException("Active session is not authenticated");
  }
  if (session.isAuthenticated()) {
    try {
      authenticationService.logout();
    } catch (NoUserSessionException e) {
      log.debug("An attempt to perform logout for expired session: {}", session, e);
    }
  }
  publishUserSessionFinishedEvent(session);
  UserSession previousSession = getSession();
  setSessionInternal(null);
  eventHub.unsubscribe(UserSubstitutedEvent.class);
  publishDisconnectedEvent(previousSession);
  fireStateChangeListeners(previousSession, null);
}
origin: com.haulmont.cuba/cuba-core

@Override
public UserSession login(String login, String password, Locale locale, Map<String, Object> params) throws LoginException {
  LoginPasswordCredentials credentials = new LoginPasswordCredentials(login, password, locale, params);
  copyParamsToCredentials(params, credentials);
  return authenticationService.login(credentials).getSession();
}
origin: com.haulmont.cuba/cuba-core

@Override
public UserSession loginByRememberMe(String login, String rememberMeToken, Locale locale, Map<String, Object> params)
    throws LoginException {
  RememberMeCredentials credentials = new RememberMeCredentials(login, rememberMeToken, locale, params);
  copyParamsToCredentials(params, credentials);
  return authenticationService.login(credentials).getSession();
}
origin: com.haulmont.cuba/cuba-rest-api

  session = authenticationService.login(credentials).getSession();
} catch (RestApiAccessDeniedException ex) {
  log.info("User is not allowed to use the REST API {}", login);
origin: com.haulmont.cuba/cuba-rest-api

  session = authenticationService.login(credentials).getSession();
} catch (LoginException e) {
  throw new OAuth2Exception("Cannot login to the middleware", e);
com.haulmont.cuba.security.authAuthenticationService

Javadoc

Authentication layer for client applications.

Most used methods

  • logout
    Log out and destroy an active user session.
  • login
    Authenticates a user, starts session and provides authentication details. Obtained session can be us
  • substituteUser
    Substitute a user, obtaining all its security related environment. This method replaces an active Us

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Notification (javax.management)
  • Table (org.hibernate.mapping)
    A relational table
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now