Skip to content

Instantly share code, notes, and snippets.

View sadrakgunadi's full-sized avatar
🎯
Focusing

Sadrak Gunadi sadrakgunadi

🎯
Focusing
View GitHub Profile
@sadrakgunadi
sadrakgunadi / DecodeJWT.md
Created January 25, 2019 14:40
Decode JWT

Decode JWT

Includes types that provide support for creating, serializing and validating JSON Web Tokens.

Code

string strJWT = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJwZG0yeG9TbWowOXY4R2xWSjlBRm9iNkw3Ylk5aVVXMVdmanhlMWFIeTdrIn0.eyJqdGkiOiIwMGZlYmM3Ny0wMzA2LTQ1ZTItODk3NS0yZjIwOTIyN2JhZDMiLCJleHAiOjE1NDc3ODE2NzksIm5iZiI6MCwiaWF0IjoxNTQ3NzgxMDc5LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvbWFzdGVyIiwic3ViIjoiZWZiOTJhY2YtMmUzZS00YWUwLTg0NzUtOTA0NjE5YTVmOTkzIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoibXlhcHAiLCJhdXRoX3RpbWUiOjAsInNlc3Npb25fc3RhdGUiOiIxZWIzNTViNi04YTI3LTQ0OWQtOTYzYy0yZTM2MDU2YmVkNjYiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbImh0dHA6Ly9sb2NhbGhvc3Q6ODA4MC8iXSwic2NvcGUiOiJlbWFpbCBwcm9maWxlIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJuYW1lIjoiU2FkcmFrIEd1bmFkaSIsInByZWZlcnJlZF91c2VybmFtZSI6InNhZHJhayIsImdpdmVuX25hbWUiOiJTYWRyYWsiLCJmYW1pbHlfbmFtZSI6Ikd1bmFkaSIsImVtYWlsIjoic2FkcmFrZ3VuY
@sadrakgunadi
sadrakgunadi / OTP.md
Created January 25, 2019 14:51
TOTP & HOTP .Net Framework

Otp.NET ( TOTP & HOTP)

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";
@sadrakgunadi
sadrakgunadi / VerifySignatureJWT.md
Last active January 25, 2019 15:35
Verify Signature JWT

Verify Signature JWT

Includes types that provide support for creating, serializing and validating JSON Web Tokens.

Code

string tokenStr = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJwZG0yeG9TbWowOXY4R2xWSjlBRm9iNkw3Ylk5aVVXMVdmanhlMWFIeTdrIn0.eyJqdGkiOiI0NzYwYWRmNC04NjNjLTRmMTQtYTYxMC1iNWNkMWMwOTY0YTgiLCJleHAiOjE1NDgyODcxNDAsIm5iZiI6MCwiaWF0IjoxNTQ4Mjg2NTQwLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvbWFzdGVyIiwic3ViIjoiZWZiOTJhY2YtMmUzZS00YWUwLTg0NzUtOTA0NjE5YTVmOTkzIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoibXlhcHAiLCJhdXRoX3RpbWUiOjAsInNlc3Npb25fc3RhdGUiOiI5MTZiODkwMy1jYTUxLTQzZWYtYjM1Ni0wOTkxZGM1ZjE3MzUiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbImh0dHA6Ly9sb2NhbGhvc3Q6ODA4MC8iXSwic2NvcGUiOiJlbWFpbCBwcm9maWxlIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJuYW1lIjoiU2FkcmFrIEd1bmFkaSIsInByZWZlcnJlZF91c2VybmFtZSI6InNhZHJhayIsImdpdmVuX25hbWUiOiJTYWRyYWsiLCJmYW1pbHlfbmFtZSI6Ikd1bmFkaSIsImVtYWlsIjoi
@sadrakgunadi
sadrakgunadi / Keycloak-REST API (Delete existing user)
Last active February 7, 2019 09:43
Keycloak-REST API (Delete existing user)
URL :
http://localhost:8080/auth/admin/realms/master/users/{user_id}
Method : DELETE
HEADER :
Bearer token