This repository was archived by the owner on Mar 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +29
-13
lines changed
Expand file tree Collapse file tree 5 files changed +29
-13
lines changed Original file line number Diff line number Diff line change 11Release notes
22=============
33
4+ Version 1.0.1
5+ ===
6+
7+ #### 1.0.1
8+ (2020-07-09)
9+
10+ Fixed:
11+
12+ - Fix wrongly thrown exception, when authorization is optional ([ Issue 154] ( https://github.com/henrikfroehling/Trakt.NET/issues/154 )
13+
14+ ---------
15+
416Version 1.0.0
517===
618
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ _**Formerly known as [TraktApiSharp](https://github.com/henrikfroehling/TraktApi
88** This is a .NET wrapper library for the [ Trakt.tv] ( https://trakt.tv/ ) [ API] ( http://docs.trakt.apiary.io/# ) .**
99
1010[ ![ Project Status] ( https://img.shields.io/badge/Project%20Status-In%20Development-green )] ( https://img.shields.io/badge/Project%20Status-In%20Development-green )
11- [ ![ NuGet Package] ( https://img.shields.io/badge/NuGet-v1.0.0 -green.svg?style=flat )] ( https://www.nuget.org/packages/Trakt.NET/1.0.0 )
11+ [ ![ NuGet Package] ( https://img.shields.io/badge/NuGet-v1.0.1 -green.svg?style=flat )] ( https://www.nuget.org/packages/Trakt.NET/1.0.1 )
1212[ ![ License] ( https://img.shields.io/badge/License-MIT-blue.svg?style=flat )] ( https://opensource.org/licenses/MIT )
1313[ ![ PRs Welcome] ( https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square )] ( http://makeapullrequest.com )
1414[ ![ Quality Gate Status] ( https://sonarcloud.io/api/project_badges/measure?project=henrikfroehling_Trakt.NET&metric=alert_status )] ( https://sonarcloud.io/dashboard?id=henrikfroehling_Trakt.NET )
Original file line number Diff line number Diff line change @@ -154,18 +154,22 @@ private void SetRequestMessageHeaders(ExtendedHttpRequestMessage requestMessage)
154154
155155 if ( authorizationRequirement != AuthorizationRequirement . NotRequired )
156156 {
157- if ( authorizationRequirement == AuthorizationRequirement . Required )
157+ if ( ! _client . Authentication . IsAuthorized )
158158 {
159- if ( ! _client . Authentication . IsAuthorized )
160- throw new TraktAuthorizationException ( "authorization is required for this request, but the current authorization parameters are invalid" ) ;
161- }
162- else if ( authorizationRequirement == AuthorizationRequirement . Optional && _client . Configuration . ForceAuthorization )
163- {
164- if ( ! _client . Authentication . IsAuthorized )
165- throw new TraktAuthorizationException ( "authorization is optional for this request, but forced and the current authorization parameters are invalid" ) ;
159+ switch ( authorizationRequirement )
160+ {
161+ case AuthorizationRequirement . Optional :
162+ if ( _client . Configuration . ForceAuthorization )
163+ throw new TraktAuthorizationException ( "authorization is optional for this request, but forced and the current authorization parameters are invalid" ) ;
164+
165+ break ;
166+ case AuthorizationRequirement . Required :
167+ throw new TraktAuthorizationException ( "authorization is required for this request, but the current authorization parameters are invalid" ) ;
168+ }
166169 }
167170
168- requestMessage . Headers . Authorization = new AuthenticationHeaderValue ( AUTHENTICATION_SCHEME , _client . Authentication . Authorization . AccessToken ) ;
171+ if ( authorizationRequirement == AuthorizationRequirement . Required || ( authorizationRequirement == AuthorizationRequirement . Optional && _client . Configuration . ForceAuthorization ) )
172+ requestMessage . Headers . Authorization = new AuthenticationHeaderValue ( AUTHENTICATION_SCHEME , _client . Authentication . Authorization . AccessToken ) ;
169173 }
170174 }
171175 }
Original file line number Diff line number Diff line change 55 <RootNamespace >TraktNet</RootNamespace >
66 <GeneratePackageOnBuild >false</GeneratePackageOnBuild >
77 <PackageRequireLicenseAcceptance >true</PackageRequireLicenseAcceptance >
8- <Version >1.0.0 </Version >
8+ <Version >1.0.1 </Version >
99 <Authors >Henrik Fröhling</Authors >
1010 <Company >Henrik Fröhling</Company >
1111 <PackageLicenseUrl >https://github.com/henrikfroehling/Trakt.NET/blob/develop/LICENSE.md</PackageLicenseUrl >
@@ -22,7 +22,7 @@ Features
2222- Language Service</Description >
2323 <RepositoryUrl >https://github.com/henrikfroehling/Trakt.NET</RepositoryUrl >
2424 <PackageTags >trakt REST</PackageTags >
25- <PackageReleaseNotes >https://github.com/henrikfroehling/Trakt.NET/blob/develop/Changelog.md#100 </PackageReleaseNotes >
25+ <PackageReleaseNotes >https://github.com/henrikfroehling/Trakt.NET/blob/develop/Changelog.md#101 </PackageReleaseNotes >
2626 </PropertyGroup >
2727
2828 <PropertyGroup Condition =" '$(Configuration)|$(Platform)'=='Debug|AnyCPU'" >
Original file line number Diff line number Diff line change 22<package xmlns =" http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd" >
33 <metadata >
44 <id >Trakt.NET</id >
5- <version >1.0.0 $versionSuffix$</version >
5+ <version >1.0.1 $versionSuffix$</version >
66 <title >Trakt.NET</title >
77 <authors >Henrik Fröhling</authors >
88 <owners >henrikfroehling</owners >
You can’t perform that action at this time.
0 commit comments