All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apereo.cas.authentication.principal.DelegatedAuthenticationCandidateProfile Maven / Gradle / Ivy

There is a newer version: 7.2.0-RC2
Show newest version
package org.apereo.cas.authentication.principal;

import lombok.Builder;
import lombok.Getter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import lombok.val;
import org.pac4j.core.profile.CommonProfile;
import org.pac4j.core.profile.UserProfile;

import javax.annotation.Nonnull;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * This is {@link DelegatedAuthenticationCandidateProfile}.
 *
 * @author Misagh Moayyed
 * @since 6.6.0
 */
@SuperBuilder
@Getter
@ToString(of = {"id", "linkedId"})
public class DelegatedAuthenticationCandidateProfile implements Serializable {
    private static final long serialVersionUID = 6377783357802049769L;

    @Nonnull
    private final String key;

    @Nonnull
    private final String id;

    @Nonnull
    private final String linkedId;

    @Builder.Default
    private Map attributes = new HashMap<>();

    /**
     * To user profile based on given client name.
     *
     * @param clientName the client name
     * @return the user profile
     */
    public UserProfile toUserProfile(final String clientName) {
        val userProfile = new CommonProfile();
        userProfile.setId(this.id);
        userProfile.setLinkedId(this.linkedId);
        userProfile.addAttributes(this.attributes);
        userProfile.setClientName(clientName);
        return userProfile;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy