package org.apereo.cas.authentication.metadata;

import org.apereo.cas.authentication.Credential;
import org.apereo.cas.authentication.CredentialMetaData;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * Basic credential metadata implementation that stores the original credential ID and the original credential type.
 * This can be used as a simple converter for any {@link Credential} that doesn't implement {@link CredentialMetaData}.
 *
 * @author Marvin S. Addison
 * @since 4.0.0
 */
@Getter
@EqualsAndHashCode
@RequiredArgsConstructor
public class BasicCredentialMetaData implements CredentialMetaData {

    /**
     * Serialization version marker.
     */
    private static final long serialVersionUID = 4929579849241505377L;

    private final Credential credential;

    @Override
    public String getId() {
        return this.credential.getId();
    }

    @Override
    public Class<? extends Credential> getCredentialClass() {
        return this.credential.getClass();
    }
}

@@ -145,24 +145,129 @@
 lMetaData;%0A%0A
+import com.fasterxml.jackson.annotation.JsonCreator;%0Aimport com.fasterxml.jackson.annotation.JsonIgnore;%0A
 import lombo
@@ -312,47 +312,8 @@
 ter;
-%0Aimport lombok.RequiredArgsConstructor;
 %0A%0A/*
@@ -634,33 +634,8 @@
 ode%0A
-@RequiredArgsConstructor%0A
 publ
@@ -867,16 +867,160 @@
 ntial;%0A%0A
+    @JsonCreator%0A    public BasicCredentialMetaData(final Credential credential) %7B%0A        this.credential = credential;%0A    %7D%0A%0A    @JsonIgnore%0A
     @Ove
@@ -1096,24 +1096,40 @@
 d();%0A    %7D%0A%0A
+    @JsonIgnore%0A
     @Overrid

fix tests