package com.atlassian.bitbucket.mesh.auth;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * Describes an authenticated principal.
 */
public interface Principal {

    /**
     * The principal's ID, which may be {@code null}. Authenticated requests from the control plane, for example,
     * will not specify an ID. Authenticated requests from other Mesh nodes will use that node's ID.
     *
     * @return the ID, which is {@code null} for the {@link ApplicationRole#CONTROL_PLANE control plane}
     */
    @Nullable
    String getId();

    /**
     * The principal's role, which can be used to control which operations the client is allowed to perform.
     *
     * @return the role
     */
    @Nonnull
    ApplicationRole getRole();
}
