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

io.camunda.service.security.auth.Authentication Maven / Gradle / Ivy

There is a newer version: 8.7.0-alpha1
Show newest version
/*
 * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
 * one or more contributor license agreements. See the NOTICE file distributed
 * with this work for additional information regarding copyright ownership.
 * Licensed under the Camunda License 1.0. You may not use this file
 * except in compliance with the Camunda License 1.0.
 */
package io.camunda.service.security.auth;

import static io.camunda.util.CollectionUtil.addValuesToList;

import io.camunda.service.search.filter.FilterBase;
import io.camunda.util.ObjectBuilder;
import java.util.List;

public record Authentication(
    String authenticatedUserId,
    List authenticatedGroupIds,
    List authenticatedTenantIds,
    String token)
    implements FilterBase {

  public static final class Builder implements ObjectBuilder {

    private String user;
    private List groups;
    private List tenants;
    private String token;

    public Builder user(final String value) {
      user = value;
      return this;
    }

    public Builder group(final String value) {
      return groups(List.of(value));
    }

    public Builder groups(final List values) {
      groups = addValuesToList(groups, values);
      return this;
    }

    public Builder tenant(final String tenant) {
      return tenants(List.of(tenant));
    }

    public Builder tenants(final List values) {
      tenants = addValuesToList(tenants, values);
      return this;
    }

    public Builder token(final String value) {
      token = value;
      return this;
    }

    @Override
    public Authentication build() {
      return new Authentication(user, groups, tenants, token);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy