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

io.camunda.identity.sdk.authentication.UserDetails Maven / Gradle / Ivy

There is a newer version: 8.5.9
Show newest version
/*
 * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
 * one or more contributor license agreements. Licensed under a proprietary license. See the
 * License.txt file for more information. You may not use this file except in compliance with the
 * proprietary license.
 */
package io.camunda.identity.sdk.authentication;

import java.io.Serializable;
import java.util.List;
import java.util.Optional;

/**
 * User info data class. An object of this class can be serialized and stored in a session.
 * It is possible that some data might be empty if a user did not provide it or when
 * a service account was used for authentication.
 */
public class UserDetails implements Serializable {
  private static final long serialVersionUID = 15047590002576681L;
  private final String id;
  private final Optional email;
  private final Optional username;
  private final Optional name;
  private final List groups;

  public UserDetails(
      final String id,
      final String email,
      final String username,
      final String name,
      final List groups
  ) {
    this.id = id;
    this.email = Optional.ofNullable(email);
    this.username = Optional.ofNullable(username);
    this.name = Optional.ofNullable(name);
    this.groups = groups;
  }

  public String getId() {
    return id;
  }

  public Optional getEmail() {
    return email;
  }

  public Optional getUsername() {
    return username;
  }

  public Optional getName() {
    return name;
  }

  public List getGroups() {
    return groups;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy