File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
test/AspNet.Security.OAuth.Providers.Tests/SuperOffice Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -92,5 +92,27 @@ static void ConfigureServices(IServiceCollection services)
92
92
// Assert
93
93
AssertClaim ( claims , claimType , claimValue ) ;
94
94
}
95
+
96
+ [ Fact ]
97
+ public async Task Cannot_Sign_In_Using_SuperOffice_With_Invalid_Token_Audience ( )
98
+ {
99
+ // Arrange
100
+ static void ConfigureServices ( IServiceCollection services )
101
+ {
102
+ services . AddSingleton < JwtSecurityTokenHandler , FrozenJwtSecurityTokenHandler > ( ) ;
103
+ services . PostConfigureAll < SuperOfficeAuthenticationOptions > ( ( options ) =>
104
+ {
105
+ options . TokenValidationParameters . ValidAudience = "not-the-right-audience" ;
106
+ } ) ;
107
+ }
108
+
109
+ using var server = CreateTestServer ( ConfigureServices ) ;
110
+
111
+ // Act
112
+ var exception = await Assert . ThrowsAsync < Exception > ( ( ) => AuthenticateUserAsync ( server ) ) ;
113
+
114
+ // Assert
115
+ exception . InnerException . ShouldBeOfType < SecurityTokenValidationException > ( ) ;
116
+ }
95
117
}
96
118
}
You can’t perform that action at this time.
0 commit comments