Skip to content

Commit ec2bb58

Browse files
Merge branch 'master' into master
2 parents db84b89 + 9141eff commit ec2bb58

File tree

8 files changed

+194
-43
lines changed

8 files changed

+194
-43
lines changed

src/Firebase.Auth.Tests/Firebase.Auth.Tests.csproj

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,17 @@
3535
<WarningLevel>4</WarningLevel>
3636
</PropertyGroup>
3737
<ItemGroup>
38-
<Reference Include="FluentAssertions, Version=3.2.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
39-
<HintPath>..\packages\FluentAssertions.3.2.1\lib\net45\FluentAssertions.dll</HintPath>
40-
<Private>True</Private>
38+
<Reference Include="FluentAssertions, Version=5.4.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
39+
<HintPath>..\packages\FluentAssertions.5.4.2\lib\net45\FluentAssertions.dll</HintPath>
4140
</Reference>
42-
<Reference Include="FluentAssertions.Core, Version=3.2.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
43-
<HintPath>..\packages\FluentAssertions.3.2.1\lib\net45\FluentAssertions.Core.dll</HintPath>
44-
<Private>True</Private>
45-
</Reference>
46-
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
47-
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
48-
<Private>True</Private>
41+
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
42+
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
4943
</Reference>
5044
<Reference Include="System" />
5145
<Reference Include="System.Net.Http" />
46+
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
47+
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
48+
</Reference>
5249
<Reference Include="System.Xml" />
5350
<Reference Include="System.Xml.Linq" />
5451
</ItemGroup>
@@ -75,6 +72,7 @@
7572
</ProjectReference>
7673
</ItemGroup>
7774
<ItemGroup>
75+
<None Include="app.config" />
7876
<None Include="packages.config" />
7977
</ItemGroup>
8078
<Choose>

src/Firebase.Auth.Tests/IntegrationTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void FacebookTest()
2727

2828
var auth = authProvider.SignInWithOAuthAsync(FirebaseAuthType.Facebook, FacebookAccessToken).Result;
2929

30-
auth.User.FirstName.ShouldBeEquivalentTo(FacebookTestUserFirstName);
30+
auth.User.FirstName.Should().BeEquivalentTo(FacebookTestUserFirstName);
3131
auth.FirebaseToken.Should().NotBeNullOrWhiteSpace();
3232
}
3333

@@ -38,7 +38,7 @@ public void GoogleTest()
3838

3939
var auth = authProvider.SignInWithOAuthAsync(FirebaseAuthType.Google, GoogleAccessToken).Result;
4040

41-
auth.User.FirstName.ShouldBeEquivalentTo(GoogleTestUserFirstName);
41+
auth.User.FirstName.Should().BeEquivalentTo(GoogleTestUserFirstName);
4242
auth.FirebaseToken.Should().NotBeNullOrWhiteSpace();
4343
}
4444

@@ -49,7 +49,7 @@ public void EmailTest()
4949

5050
var auth = authProvider.SignInWithEmailAndPasswordAsync(FirebaseEmail, FirebasePassword).Result;
5151

52-
auth.User.Email.ShouldBeEquivalentTo(FirebaseEmail);
52+
auth.User.Email.Should().BeEquivalentTo(FirebaseEmail);
5353
auth.FirebaseToken.Should().NotBeNullOrWhiteSpace();
5454
}
5555

@@ -117,7 +117,7 @@ public void CreateUserTest()
117117

118118
var auth = authProvider.SignInWithEmailAndPasswordAsync(email, "test1234").Result;
119119

120-
auth.User.Email.ShouldBeEquivalentTo(email);
120+
auth.User.Email.Should().BeEquivalentTo(email);
121121
auth.FirebaseToken.Should().NotBeNullOrWhiteSpace();
122122
}
123123

@@ -130,7 +130,7 @@ public void LinkAccountsTest()
130130
var auth = authProvider.SignInAnonymouslyAsync().Result;
131131
var newAuth = auth.LinkToAsync(email, "test1234").Result;
132132

133-
newAuth.User.Email.ShouldBeEquivalentTo(email);
133+
newAuth.User.Email.Should().BeEquivalentTo(email);
134134
newAuth.User.LocalId.Should().Be(auth.User.LocalId);
135135
newAuth.FirebaseToken.Should().NotBeNullOrWhiteSpace();
136136
}
@@ -144,7 +144,7 @@ public void LinkAccountsFacebookTest()
144144
var newAuth = auth.LinkToAsync(FirebaseAuthType.Facebook, FacebookAccessToken).Result;
145145

146146
newAuth.User.LocalId.Should().Be(auth.User.LocalId);
147-
newAuth.User.FirstName.ShouldBeEquivalentTo(FacebookTestUserFirstName);
147+
newAuth.User.FirstName.Should().BeEquivalentTo(FacebookTestUserFirstName);
148148
newAuth.FirebaseToken.Should().NotBeNullOrWhiteSpace();
149149
}
150150

@@ -158,7 +158,7 @@ public void GetLinkedAccountsTest()
158158
var linkedAccounts = authProvider.GetLinkedAccountsAsync(email).Result;
159159

160160
linkedAccounts.IsRegistered.Should().BeTrue();
161-
linkedAccounts.Providers.Single().ShouldBeEquivalentTo(FirebaseAuthType.EmailAndPassword);
161+
linkedAccounts.Providers.Single().Should().BeEquivalentTo(FirebaseAuthType.EmailAndPassword);
162162
}
163163

164164
[TestMethod]

src/Firebase.Auth.Tests/app.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<runtime>
4+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5+
<dependentAssembly>
6+
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
7+
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
8+
</dependentAssembly>
9+
</assemblyBinding>
10+
</runtime>
11+
</configuration>
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="FluentAssertions" version="3.2.1" targetFramework="net46" />
4-
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net46" />
3+
<package id="FluentAssertions" version="5.4.2" targetFramework="net46" />
4+
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net46" />
5+
<package id="System.ValueTuple" version="4.5.0" targetFramework="net46" />
56
</packages>

src/Firebase.Auth/Firebase.Auth.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard1.1</TargetFramework>
55
<PackageId>FirebaseAuthentication.net</PackageId>
6-
<PackageVersion>3.0.6</PackageVersion>
6+
<PackageVersion>3.2.0</PackageVersion>
77
<Authors>Step Up Labs, Inc.</Authors>
88
<Description>Firebase authentication library. It can generate Firebase auth token based on given OAuth token (issued by Google, Facebook...). This Firebase token can then be used with REST queries against Firebase endpoints. </Description>
99
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
@@ -17,7 +17,7 @@
1717
</PropertyGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
20+
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
2121
</ItemGroup>
2222

2323
</Project>

src/Firebase.Auth/FirebaseAuthLink.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public async Task<FirebaseAuthLink> LinkToAsync(string email, string password)
4141
}
4242

4343
/// <summary>
44-
/// Links the this user with and account from a third party provider.
44+
/// Links the user with an account from a third party provider.
4545
/// </summary>
4646
/// <param name="authType"> The auth type. </param>
4747
/// <param name="oauthAccessToken"> The access token retrieved from login provider of your choice. </param>
@@ -55,11 +55,25 @@ public async Task<FirebaseAuthLink> LinkToAsync(FirebaseAuthType authType, strin
5555
return this;
5656
}
5757

58+
/// <summary>
59+
/// Unlinks the user from the given <see cref="authType"/> (provider).
60+
/// </summary>
61+
/// <param name="authType"> The auth type. </param>
62+
/// <returns> The <see cref="FirebaseAuthLink"/>. </returns>
63+
public async Task<FirebaseAuthLink> UnlinkFromAsync(FirebaseAuthType authType)
64+
{
65+
var auth = await this.AuthProvider.UnlinkAccountsAsync(this, authType).ConfigureAwait(false);
66+
67+
this.CopyPropertiesLocally(auth.AuthProvider, auth);
68+
69+
return this;
70+
}
71+
5872
public async Task RefreshUserDetails()
5973
{
6074
if (this.AuthProvider != null && !string.IsNullOrEmpty(this.FirebaseToken))
6175
{
62-
this.User = await this.AuthProvider.GetUserAsync(this.FirebaseToken);
76+
this.User = await this.AuthProvider.GetUserAsync(this.FirebaseToken).ConfigureAwait(false);
6377
}
6478
}
6579

@@ -75,6 +89,15 @@ public async Task<FirebaseAuthLink> GetFreshAuthAsync()
7589
return this;
7690
}
7791

92+
public async Task<FirebaseAuthLink> UpdateProfileAsync(string displayName, string photoUrl)
93+
{
94+
var auth = await this.AuthProvider.UpdateProfileAsync(this.FirebaseToken, displayName, photoUrl).ConfigureAwait(false);
95+
96+
this.CopyPropertiesLocally(auth.AuthProvider, auth);
97+
98+
return this;
99+
}
100+
78101
protected void OnFirebaseAuthRefreshed(FirebaseAuth auth)
79102
{
80103
this.FirebaseAuthRefreshed?.Invoke(this, new FirebaseAuthEventArgs(auth));

0 commit comments

Comments
 (0)