コード例 #1
0
        public override Task GrantClientCredentials(OAuthGrantClientCredentialsContext context) {
            var identity = new ClaimsIdentity(AuthenticationType.Anonymous);
            var systemUtc = new SystemClock().UtcNow;
            var ticket = new AuthenticationTicket(identity, new AuthenticationProperties {
                IssuedUtc = systemUtc,
                ExpiresUtc = systemUtc.AddMinutes(20)
            });
            context.Validated(ticket);

            return base.GrantClientCredentials(context);
        }