package org.apereo.cas.adaptors.u2f.storage;

import com.github.benmanes.caffeine.cache.LoadingCache;
import org.apereo.cas.CipherExecutor;

import java.io.Serializable;

/**
 * This is {@link BaseU2FDeviceRepository}.
 *
 * @author Misagh Moayyed
 * @since 5.1.0
 */
public abstract class BaseU2FDeviceRepository implements U2FDeviceRepository {
    private final LoadingCache<String, String> requestStorage;

    private CipherExecutor<Serializable, String> cipherExecutor;

    public CipherExecutor<Serializable, String> getCipherExecutor() {
        return cipherExecutor;
    }

    public void setCipherExecutor(final CipherExecutor<Serializable, String> cipherExecutor) {
        this.cipherExecutor = cipherExecutor;
    }

    public BaseU2FDeviceRepository(final LoadingCache<String, String> requestStorage) {
        this.requestStorage = requestStorage;
    }

    @Override
    public String getDeviceRegistrationRequest(final String requestId, final String username) {
        final String request = requestStorage.get(requestId);
        requestStorage.invalidate(requestId);
        requestStorage.cleanUp();
        return request;
    }

    @Override
    public String getDeviceAuthenticationRequest(final String requestId, final String username) {
        final String request = requestStorage.get(requestId);
        requestStorage.invalidate(requestId);
        requestStorage.cleanUp();
        return request;
    }

    @Override
    public void requestDeviceRegistration(final String requestId, final String username, final String registrationJsonData) {
        requestStorage.put(requestId, registrationJsonData);
    }

    @Override
    public void requestDeviceAuthentication(final String requestId, final String username, final String registrationJsonData) {
        requestStorage.put(requestId, registrationJsonData);
    }
}

@@ -403,17 +403,16 @@
 torage;%0A
-%0A
     priv
@@ -469,16 +469,157 @@
 cutor;%0A%0A
+    public BaseU2FDeviceRepository(final LoadingCache%3CString, String%3E requestStorage) %7B%0A        this.requestStorage = requestStorage;%0A    %7D%0A%0A
     publ
@@ -870,149 +870,8 @@
  %7D%0A%0A
-    public BaseU2FDeviceRepository(final LoadingCache%3CString, String%3E requestStorage) %7B%0A        this.requestStorage = requestStorage;%0A    %7D%0A%0A
     

Fix checkstyle