Convert Date Time to Unix Timestamp and Vice Versa (seconds or milliseconds format)
using SG.UnixTime;
example 1 :
Web Config | |
----------- | |
<system.webServer> | |
<httpProtocol> | |
<!--<customHeaders> | |
<add name="Access-Control-Allow-Origin" value="*" /> | |
<add name="Access-Control-Allow-Headers" value="*" /> | |
<add name="Access-Control-Allow-Methods" value="GET,POST,PUT" /> | |
<add name="Access-Control-Allow-Credentials" value="true" /> | |
</customHeaders>--> |
TokenValidationParameters tvp = new TokenValidationParameters() { | |
ValidateActor = false, | |
// check the profile ID | |
ValidateAudience = true, | |
// check the client ID | |
ValidAudience = CLIENT_ID, | |
ValidateIssuer = true, | |
// check token came from Google | |
ValidIssuers = new List < string > { |
URL : | |
http://localhost:8080/auth/admin/realms/master/users/{user_id} | |
Method : DELETE | |
HEADER : | |
Bearer token |
URL : | |
http://localhost:8080/auth/admin/realms/master/users/{user_id} | |
Method : PUT | |
Header : | |
Bearer token | |
Body : | |
{ |
URL : | |
http://localhost:8080/auth/admin/realms/master/users | |
Method : POST | |
Header : | |
Bearer token | |
Body : | |
{ |
Source : BouncyCastle
Code
RsaKeyPairGenerator g = new RsaKeyPairGenerator();
Source : BouncyCastle
Code
class Program {
private static RSAParameters rsaPubParams;
Includes types that provide support for creating, serializing and validating JSON Web Tokens.
Code
string tokenStr = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJwZG0yeG9TbWowOXY4R2xWSjlBRm9iNkw3Ylk5aVVXMVdmanhlMWFIeTdrIn0.eyJqdGkiOiI0NzYwYWRmNC04NjNjLTRmMTQtYTYxMC1iNWNkMWMwOTY0YTgiLCJleHAiOjE1NDgyODcxNDAsIm5iZiI6MCwiaWF0IjoxNTQ4Mjg2NTQwLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvbWFzdGVyIiwic3ViIjoiZWZiOTJhY2YtMmUzZS00YWUwLTg0NzUtOTA0NjE5YTVmOTkzIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoibXlhcHAiLCJhdXRoX3RpbWUiOjAsInNlc3Npb25fc3RhdGUiOiI5MTZiODkwMy1jYTUxLTQzZWYtYjM1Ni0wOTkxZGM1ZjE3MzUiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbImh0dHA6Ly9sb2NhbGhvc3Q6ODA4MC8iXSwic2NvcGUiOiJlbWFpbCBwcm9maWxlIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJuYW1lIjoiU2FkcmFrIEd1bmFkaSIsInByZWZlcnJlZF91c2VybmFtZSI6InNhZHJhayIsImdpdmVuX25hbWUiOiJTYWRyYWsiLCJmYW1pbHlfbmFtZSI6Ikd1bmFkaSIsImVtYWlsIjoi
An implementation of TOTP and HOTP which are commonly used for multi factor authentication by using a shared key between the client and the server to generate and verify one time use codes.
Code
long _counter = 0;
string isRepeat = "N";