@@ -11,48 +11,48 @@ namespace Microsoft.SCIM
1111 using Microsoft . AspNetCore . Mvc ;
1212 using Microsoft . IdentityModel . Tokens ;
1313
14- // Controller for generating a bearer token for authorization during testing.
15- // This is not meant to replace proper Oauth for authentication purposes.
16- [ Route ( ServiceConstants . RouteToken ) ]
17- [ ApiController ]
18- public class KeyController : ControllerTemplate
19- {
20- private const int TokenLifetimeInMins = 120 ;
21-
22- public KeyController ( IProvider provider , IMonitor monitor )
23- : base ( provider , monitor )
24- {
25- }
26-
27- private static string GenerateJSONWebToken ( )
28- {
29- SymmetricSecurityKey securityKey =
30- new SymmetricSecurityKey ( Encoding . UTF8 . GetBytes ( ServiceConstants . TokenIssuer ) ) ;
31- SigningCredentials credentials =
32- new SigningCredentials ( securityKey , SecurityAlgorithms . HmacSha256 ) ;
33-
34- DateTime startTime = DateTime . UtcNow ;
35- DateTime expiryTime = startTime . AddMinutes ( KeyController . TokenLifetimeInMins ) ;
36-
37- JwtSecurityToken token =
38- new JwtSecurityToken (
39- ServiceConstants . TokenIssuer ,
40- ServiceConstants . TokenAudience ,
41- null ,
42- notBefore : startTime ,
43- expires : expiryTime ,
44- signingCredentials : credentials ) ;
45-
46- string result = new JwtSecurityTokenHandler ( ) . WriteToken ( token ) ;
47- return result ;
48- }
49-
50- [ HttpGet ]
51- public ActionResult Get ( )
52- {
53- string tokenString = KeyController . GenerateJSONWebToken ( ) ;
54- return this . Ok ( new { token = tokenString } ) ;
55- }
56-
57- }
14+ //// Controller for generating a bearer token for authorization during testing.
15+ //// This is not meant to replace proper Oauth for authentication purposes.
16+ // [Route(ServiceConstants.RouteToken)]
17+ // [ApiController]
18+ // public class KeyController : ControllerTemplate
19+ // {
20+ // private const int TokenLifetimeInMins = 120;
21+
22+ // public KeyController(IProvider provider, IMonitor monitor)
23+ // : base(provider, monitor)
24+ // {
25+ // }
26+
27+ // private static string GenerateJSONWebToken()
28+ // {
29+ // SymmetricSecurityKey securityKey =
30+ // new SymmetricSecurityKey(Encoding.UTF8.GetBytes(ServiceConstants.TokenIssuer));
31+ // SigningCredentials credentials =
32+ // new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);
33+
34+ // DateTime startTime = DateTime.UtcNow;
35+ // DateTime expiryTime = startTime.AddMinutes(KeyController.TokenLifetimeInMins);
36+
37+ // JwtSecurityToken token =
38+ // new JwtSecurityToken(
39+ // ServiceConstants.TokenIssuer,
40+ // ServiceConstants.TokenAudience,
41+ // null,
42+ // notBefore: startTime,
43+ // expires: expiryTime,
44+ // signingCredentials: credentials);
45+
46+ // string result = new JwtSecurityTokenHandler().WriteToken(token);
47+ // return result;
48+ // }
49+
50+ // [HttpGet]
51+ // public ActionResult Get()
52+ // {
53+ // string tokenString = KeyController.GenerateJSONWebToken();
54+ // return this.Ok(new { token = tokenString });
55+ // }
56+
57+ // }
5858}
0 commit comments