/// <summary> /// Creates a new orphan token. /// A root token is not required to create an orphan token /// (otherwise set with the no_parent option). /// </summary> /// <remarks> /// Certain options are only available when called by a root token. /// </remarks> public static async Task <ReadResponse <EmptyData> > CreateOrphanTokenAsync(this VaultClient client, CreateParameters createParameters = null, TokenAuthOptions options = null) { return(await CreateTokenAsync(client, true, null, createParameters, options : options)); }
/// <summary> /// Creates a new token against the specified role name. /// This may override options set during the call. /// </summary> /// <remarks> /// Certain options are only available when called by a root token. /// </remarks> public static async Task <ReadResponse <EmptyData> > CreateRoleTokenAsync(this VaultClient client, string roleName, CreateParameters createParameters = null, TokenAuthOptions options = null) { return(await CreateTokenAsync(client, false, roleName, createParameters, options : options)); }
private static async Task <ReadResponse <EmptyData> > CreateTokenAsync(VaultClient client, bool createOrphan, string roleName, CreateParameters createParameters = null, TokenAuthOptions options = null) { var mountName = options?.MountName ?? DefaultMountName; return(await((IProtocolSource)client).Protocol .SendPostAsync <ReadResponse <EmptyData> >( $"auth/{mountName}/create", createParameters, options: options)); }