public static void removeStoredSession(CredentialsStoreBuilder.StorageType storageType) { CredentialsStore storage = new CredentialsStoreBuilder() .setContext(LiferayScreensContext.getContext()) .setStorageType(storageType) .build(); checkIfStorageTypeIsSupported(storageType, storage); storage.removeStoredCredentials(); }
public static void loadSessionFromStore(CredentialsStoreBuilder.StorageType storageType) throws IllegalStateException { CredentialsStore storage = new CredentialsStoreBuilder() .setContext(LiferayScreensContext.getContext()) .setStorageType(storageType) .build(); checkIfStorageTypeIsSupported(storageType, storage); if (storage.loadStoredCredentials()) { _session = new SessionImpl(LiferayServerContext.getServer(), storage.getAuthentication()); _loggedUser = storage.getUser(); } }
public static void storeSession(CredentialsStoreBuilder.StorageType storageType) { if (!hasSession()) { throw new IllegalStateException("You must have a session created to store it"); } CredentialsStore storage = new CredentialsStoreBuilder() .setContext(LiferayScreensContext.getContext()) .setAuthentication(_session.getAuthentication()) .setUser(getLoggedUser()) .setStorageType(storageType) .build(); checkIfStorageTypeIsSupported(storageType, storage); storage.storeCredentials(); }