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(); }