Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit b345867

Browse files
committed
Remove remaining SS.Text restrictions
1 parent 7ef25cd commit b345867

File tree

8 files changed

+1
-120
lines changed

8 files changed

+1
-120
lines changed

lib/ServiceStack.Client.dll

-512 Bytes
Binary file not shown.

lib/ServiceStack.Common.dll

512 Bytes
Binary file not shown.

lib/ServiceStack.Interfaces.dll

0 Bytes
Binary file not shown.

lib/tests/ServiceStack.Interfaces.dll

0 Bytes
Binary file not shown.

src/ServiceStack.Text/LicenseUtils.cs

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,7 @@ public static void RegisterLicense(string licenseKeyText)
174174
var parts = licenseKeyText.SplitOnFirst('-');
175175
cutomerId = parts[0];
176176

177-
LicenseKey key;
178-
using (new AccessToken(LicenseFeature.Text))
179-
{
180-
key = PclExport.Instance.VerifyLicenseKeyText(licenseKeyText);
181-
}
177+
var key = PclExport.Instance.VerifyLicenseKeyText(licenseKeyText);
182178

183179
var releaseDate = Env.GetReleaseDate();
184180
if (releaseDate > key.Expiry)
@@ -243,12 +239,6 @@ public static void AssertValidUsage(LicenseFeature feature, QuotaType quotaType,
243239
if ((LicenseFeature.All & licensedFeatures) == LicenseFeature.All) //Standard Usage
244240
return;
245241

246-
if (AccessTokenScope != null)
247-
{
248-
if ((feature & AccessTokenScope.tempFeatures) == feature)
249-
return;
250-
}
251-
252242
//Free Quotas
253243
switch (feature)
254244
{
@@ -393,71 +383,5 @@ public static Exception GetInnerMostException(this Exception ex)
393383
}
394384
return ex;
395385
}
396-
397-
[ThreadStatic]
398-
private static AccessToken AccessTokenScope;
399-
private class AccessToken : IDisposable
400-
{
401-
private readonly AccessToken prevToken;
402-
internal readonly LicenseFeature tempFeatures;
403-
internal AccessToken(LicenseFeature requested)
404-
{
405-
prevToken = AccessTokenScope;
406-
AccessTokenScope = this;
407-
tempFeatures = requested;
408-
}
409-
410-
public void Dispose()
411-
{
412-
AccessTokenScope = prevToken;
413-
}
414-
}
415-
416-
static class _approved
417-
{
418-
internal static readonly HashSet<string> __tokens = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
419-
{
420-
"ServiceStack.ServiceClientBase+AccessToken",
421-
"ServiceStack.JsonHttpClient+AccessToken",
422-
"ServiceStack.RabbitMq.RabbitMqProducer+AccessToken",
423-
"ServiceStack.Messaging.RedisMessageQueueClient+AccessToken",
424-
"ServiceStack.Messaging.RedisMessageProducer+AccessToken",
425-
"ServiceStack.Aws.Support.AwsClientUtils+AccessToken",
426-
};
427-
428-
internal static readonly HashSet<string> __dlls = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
429-
{
430-
"ServiceStack.HttpClient.dll",
431-
"ServiceStack.Client.dll",
432-
"ServiceStack.RabbitMq.dll",
433-
"ServiceStack.Aws.dll",
434-
"<Unknown>"
435-
};
436-
}
437-
438-
[Obsolete("Should no longer be needed")]
439-
public static IDisposable RequestAccess(object accessToken, LicenseFeature srcFeature, LicenseFeature requestedAccess)
440-
{
441-
var accessType = accessToken.GetType();
442-
443-
if (srcFeature != LicenseFeature.Client || requestedAccess != LicenseFeature.Text || accessToken == null)
444-
throw new LicenseException(ErrorMessages.UnauthorizedAccessRequest).Trace();
445-
446-
if (accessType.Name == "AccessToken" && accessType.GetAssembly().ManifestModule.Name.StartsWith("<")) //Smart Assembly
447-
return new AccessToken(requestedAccess);
448-
449-
if (!_approved.__tokens.Contains(accessType.FullName))
450-
{
451-
var errorDetails = " __token: '{0}', Assembly: '{1}'".Fmt(
452-
accessType.Name,
453-
accessType.GetAssembly().ManifestModule.Name);
454-
455-
throw new LicenseException(ErrorMessages.UnauthorizedAccessRequest + errorDetails).Trace();
456-
}
457-
458-
PclExport.Instance.VerifyInAssembly(accessType, _approved.__dlls);
459-
460-
return new AccessToken(requestedAccess);
461-
}
462386
}
463387
}

src/ServiceStack.Text/PclExport.Net40.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -520,33 +520,6 @@ public override LicenseKey VerifyLicenseKeyText(string licenseKeyText)
520520
return key;
521521
}
522522

523-
public override void VerifyInAssembly(Type accessType, ICollection<string> assemblyNames)
524-
{
525-
//might get merged/mangled on alt platforms
526-
if (assemblyNames.Contains(accessType.Assembly.ManifestModule.Name))
527-
return;
528-
529-
try
530-
{
531-
if (typeof(PclExport).Assembly.ManifestModule.Name != "ServiceStack.Text.dll")
532-
return; //Smart/Packaged Assembly
533-
534-
if (assemblyNames.Contains(accessType.Assembly.Location.SplitOnLast(Path.DirectorySeparatorChar).Last()))
535-
return;
536-
}
537-
catch (Exception)
538-
{
539-
return; //dynamic assembly
540-
}
541-
542-
var errorDetails = " Type: '{0}', Assembly: '{1}', '{2}'".Fmt(
543-
accessType.Name,
544-
accessType.Assembly.ManifestModule.Name,
545-
accessType.Assembly.Location);
546-
547-
throw new LicenseException(LicenseUtils.ErrorMessages.UnauthorizedAccessRequest + errorDetails);
548-
}
549-
550523
public override void BeginThreadAffinity()
551524
{
552525
Thread.BeginThreadAffinity();
@@ -734,10 +707,6 @@ public IosPclExport()
734707
SupportsEmit = SupportsExpression = false;
735708
}
736709

737-
public override void VerifyInAssembly(Type accessType, ICollection<string> assemblyNames)
738-
{
739-
}
740-
741710
public new static void Configure()
742711
{
743712
Configure(Provider);
@@ -978,10 +947,6 @@ public AndroidPclExport()
978947
PlatformName = "Android";
979948
}
980949

981-
public override void VerifyInAssembly(Type accessType, ICollection<string> assemblyNames)
982-
{
983-
}
984-
985950
public new static void Configure()
986951
{
987952
Configure(Provider);

src/ServiceStack.Text/PclExport.WinStore.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ public override string GetAssemblyCodeBase(Assembly assembly)
129129
// return TimeZoneInfo.ConvertTimeToUtc(dateTime);
130130
//}
131131

132-
public override void VerifyInAssembly(Type accessType, ICollection<string> assemblyNames)
133-
{
134-
}
135-
136132
public static void InitForAot()
137133
{
138134
}

src/ServiceStack.Text/PclExport.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,6 @@ public virtual LicenseKey VerifyLicenseKeyText(string licenseKeyText)
449449
return licenseKeyText.ToLicenseKey();
450450
}
451451

452-
public virtual void VerifyInAssembly(Type accessType, ICollection<string> assemblyNames)
453-
{
454-
}
455-
456452
public virtual void BeginThreadAffinity()
457453
{
458454
}

0 commit comments

Comments
 (0)