<commit_before>﻿using System;
using System.IdentityModel.Tokens;
using System.Security.Claims;
using ExampleHttpServer.Properties;
using Microsoft.Owin.Security.DataHandler.Encoder;

namespace ExampleHttpServer.Auth
{
    public class JwtTokenService
    {

        private static readonly JwtSecurityTokenHandler TokenHandler = new JwtSecurityTokenHandler();
        private readonly string _issuer;
        private readonly string _audience;
        private readonly byte[] _tokenSigningKey;
        
        public JwtTokenService() : this(
            Settings.Default.Issuer,
            Settings.Default.Audience,
            TextEncodings.Base64.Decode(Settings.Default.TokenSigningKey))
        {
        }

        public JwtTokenService(string issuer, string audience, byte[] tokenSigningKey)
        {
            _issuer = issuer;
            _audience = audience;
            _tokenSigningKey =  tokenSigningKey;
        }

        public string GenerateToken(string username)
        {
            if (username == null)
                throw new ArgumentNullException("username");

            // create JWT token
            var token = TokenHandler.CreateToken(
                subject: new ClaimsIdentity(new[] {
				    new Claim(ClaimTypes.Name, username),
                    new Claim(ClaimTypes.GivenName, "John"),
                    new Claim(ClaimTypes.Surname, "Doe"),
                    new Claim(ClaimTypes.Email, "<EMAIL>")
			    }),
                issuer: _issuer,
                audience: _audience,
                signingCredentials: new SigningCredentials(
                    new InMemorySymmetricSecurityKey(_tokenSigningKey),
                    "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256",
                    "http://www.w3.org/2001/04/xmlenc#sha256")
                );

            // write JWT token to string format
            return TokenHandler.WriteToken(token);
        }

    }
}
<commit_msg>Even even more cosmetic changes<commit_after>﻿using System;
using System.IdentityModel.Tokens;
using System.Security.Claims;
using ExampleHttpServer.Properties;
using Microsoft.Owin.Security.DataHandler.Encoder;

namespace ExampleHttpServer.Auth
{
    public class JwtTokenService
    {

        private static readonly JwtSecurityTokenHandler TokenHandler = new JwtSecurityTokenHandler();
        private readonly string _issuer;
        private readonly string _audience;
        private readonly byte[] _tokenSigningKey;
        
        public JwtTokenService() : this(
            Settings.Default.Issuer,
            Settings.Default.Audience,
            TextEncodings.Base64.Decode(Settings.Default.TokenSigningKey))
        {
        }

        public JwtTokenService(string issuer, string audience, byte[] tokenSigningKey)
        {
            _issuer = issuer;
            _audience = audience;
            _tokenSigningKey =  tokenSigningKey;
        }

        public string GenerateToken(string username)
        {
            if (username == null)
                throw new ArgumentNullException("username");

            // create JWT token
            var token = TokenHandler.CreateToken(
                subject: new ClaimsIdentity(new[] {
                    new Claim(ClaimTypes.Name, username),
                    new Claim(ClaimTypes.GivenName, "John"),
                    new Claim(ClaimTypes.Surname, "Doe"),
                    new Claim(ClaimTypes.Email, "<EMAIL>")
			    }),
                issuer: _issuer,
                audience: _audience,
                signingCredentials: new SigningCredentials(
                    new InMemorySymmetricSecurityKey(_tokenSigningKey),
                    "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256",
                    "http://www.w3.org/2001/04/xmlenc#sha256")
                );

            // write JWT token to string format
            return TokenHandler.WriteToken(token);
        }

    }
}

{'fraction_non_alphanumeric': 0.08176739461655663, 'fraction_numerical': 0.0111731843575419, 'mean_word_length': 1.9242761692650334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '680626', 'n_tokens_mistral': 1063, 'n_tokens_neox': 984, 'n_words': 210}