Skip to content

Commit 7d7ca91

Browse files
author
Eduardo V. Bruno
authored
Merge pull request #119 from fauna/revert-auth-fun
Revert new auth functions
2 parents 70979ce + 59c29fb commit 7d7ca91

File tree

3 files changed

+0
-124
lines changed

3 files changed

+0
-124
lines changed

FaunaDB.Client.Test/ClientTest.cs

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,92 +2171,6 @@ public async Task TestCustomHttp()
21712171
Assert.AreEqual(faunaEndpoint, myHttpClient.LastMessage.RequestUri.ToString());
21722172
}
21732173

2174-
[Test]
2175-
public async Task TestAuthProviders()
2176-
{
2177-
string roleName = RandomStartingWith("role_");
2178-
string accessProviderName = RandomStartingWith("access_prov_");
2179-
string issuerName = RandomStartingWith("issuer_");
2180-
string jwksUri = "https://xxxx.auth0.com/";
2181-
2182-
RefV collection = await RandomCollection();
2183-
2184-
RefV role = GetRef(await adminClient.Query(CreateRole(Obj(
2185-
"name", roleName,
2186-
"privileges", Arr(Obj(
2187-
"resource", collection,
2188-
"actions", Obj("read", true)
2189-
))
2190-
))));
2191-
2192-
Value accessProvider = await adminClient.Query(CreateAccessProvider(
2193-
Obj(
2194-
"name", accessProviderName,
2195-
"issuer", issuerName,
2196-
"jwks_uri", jwksUri,
2197-
"allowed_collections", Arr(collection),
2198-
"allowed_roles", Arr(role)
2199-
)));
2200-
2201-
Assert.AreEqual(
2202-
accessProviderName,
2203-
accessProvider.Get(Field.At("name")).To<string>().Value);
2204-
2205-
Assert.AreEqual(
2206-
issuerName,
2207-
accessProvider.Get(Field.At("issuer")).To<string>().Value);
2208-
2209-
Assert.AreEqual(
2210-
"https://xxxx.auth0.com/",
2211-
accessProvider.Get(Field.At("jwks_uri")).To<string>().Value);
2212-
2213-
Assert.AreEqual(
2214-
collection,
2215-
accessProvider.Get(Field.At("allowed_collections")).To<ArrayV>().Value.First());
2216-
2217-
Assert.AreEqual(
2218-
role,
2219-
accessProvider.Get(Field.At("allowed_roles")).To<ArrayV>().Value.First());
2220-
2221-
// Retrieving
2222-
2223-
Value accessProviderFromDB =
2224-
await adminClient.Query(Get(AccessProvider(accessProviderName)));
2225-
2226-
Assert.AreEqual(accessProvider, accessProviderFromDB);
2227-
Assert.AreEqual(
2228-
jwksUri,
2229-
accessProviderFromDB.Get(Field.At("jwks_uri")).To<string>().Value);
2230-
2231-
// Retrieving: Denied
2232-
2233-
var ex = Assert.ThrowsAsync<PermissionDenied>(
2234-
async () => await client.Query(Get(AccessProvider(accessProviderName)))
2235-
);
2236-
2237-
AssertErrors(ex, code: "permission denied", description: "Insufficient privileges to perform the action.");
2238-
AssertEmptyFailures(ex);
2239-
AssertPosition(ex, positions: Is.EquivalentTo(new List<string> { }));
2240-
2241-
// Paginating
2242-
2243-
var otherName = RandomStartingWith("ap_");
2244-
2245-
await adminClient.Query(CreateAccessProvider(
2246-
Obj(
2247-
"name", otherName,
2248-
"issuer", RandomStartingWith("ap_"),
2249-
"jwks_uri", jwksUri
2250-
)));
2251-
2252-
Value page = await adminClient.Query(Paginate(AccessProviders()));
2253-
RefV[] pageData = page.Get(DATA).To<RefV[]>().Value;
2254-
2255-
Assert.AreEqual(2, pageData.Length);
2256-
Assert.AreEqual(accessProviderName, pageData.First().Id);
2257-
Assert.AreEqual(otherName, pageData.Last().Id);
2258-
}
2259-
22602174
private async Task<Value> NewCollectionWithValues(string colName, string indexName, int size = 10, bool indexWithAllValues = false)
22612175
{
22622176
RefV aCollection = (await client.Query(CreateCollection(Obj("name", colName))))

FaunaDB.Client/Query/Language.Authentication.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -59,41 +59,5 @@ public static Expr Identity() =>
5959
/// </summary>
6060
public static Expr HasIdentity() =>
6161
UnescapedObject.With("has_identity", Null());
62-
63-
/// <summary>
64-
/// Creates a new AccessProviders expression.
65-
/// <para>
66-
/// See the <see href="https://docs.fauna.com/fauna/current/api/fql/functions/accessprovider">docs</see>.
67-
/// </para>
68-
/// </summary>
69-
public static Expr AccessProviders(Expr scope = null) =>
70-
UnescapedObject.With("access_providers", scope ?? Null());
71-
72-
/// <summary>
73-
/// Creates a new AccessProvider expression.
74-
/// <para>
75-
/// See the <see href="https://docs.fauna.com/fauna/current/api/fql/functions/accessprovider">docs</see>.
76-
/// </para>
77-
/// </summary>
78-
public static Expr AccessProvider(Expr name) =>
79-
UnescapedObject.With("access_provider", name);
80-
81-
/// <summary>
82-
/// Creates a new AccessProvider expression.
83-
/// <para>
84-
/// See the <see href="https://docs.fauna.com/fauna/current/api/fql/functions/accessprovider">docs</see>.
85-
/// </para>
86-
/// </summary>
87-
public static Expr AccessProvider(Expr name, Expr scope) =>
88-
UnescapedObject.With("access_provider", name, "scope", scope);
89-
90-
/// <summary>
91-
/// Creates a new CreateAccessProvider expression.
92-
/// <para>
93-
/// See the <see href="https://app.fauna.com/documentation/reference/queryapi#write-functions">docs</see>.
94-
/// </para>
95-
/// </summary>
96-
public static Expr CreateAccessProvider(Expr expr) =>
97-
UnescapedObject.With("create_access_provider", expr);
9862
}
9963
}

FaunaDB.Client/Types/RefV.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public override string ToString()
7171

7272
public static class Native
7373
{
74-
public static readonly RefV ACCESS_PROVIDERS = new RefV("access_providers");
7574
public static readonly RefV COLLECTIONS = new RefV("collections");
7675
public static readonly RefV INDEXES = new RefV("indexes");
7776
public static readonly RefV DATABASES = new RefV("databases");
@@ -85,7 +84,6 @@ internal static RefV FromName(string name)
8584
{
8685
switch (name)
8786
{
88-
case "access_providers": return ACCESS_PROVIDERS;
8987
case "collections": return COLLECTIONS;
9088
case "indexes": return INDEXES;
9189
case "databases": return DATABASES;

0 commit comments

Comments
 (0)