Skip to content

Instantly share code, notes, and snippets.

View tarikhagustia's full-sized avatar
🎯
Focusing

Tarikh Agustia tarikhagustia

🎯
Focusing
View GitHub Profile
@tarikhagustia
tarikhagustia / jwt-expiration.md
Created July 3, 2020 01:44 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

[options]
#
# WARNING:
# If you use the Odoo Database utility to change the master password be aware
# that the formatting of this file WILL be LOST! A copy of this file named
# /etc/odoo/openerp-server.conf.template has been made in case this happens
# Note that the copy does not have any first boot changes
#-----------------------------------------------------------------------------
# Odoo Server Config File - TurnKey Linux
@tarikhagustia
tarikhagustia / block-expire-date.php
Created July 19, 2019 02:33 — forked from cgi-caesar/block-expire-date.php
aMember: example of plugin that add new widget to user dashboard
<?php
class Am_Plugin_BlockExpireDate extends Am_Plugin
{
const PLUGIN_STATUS = self::STATUS_PRODUCTION;
const PLUGIN_COMM = self::COMM_COMMERCIAL;
const PLUGIN_REVISION = '@@VERSION@@';
const DEFAULT_TPL = '<div class="am-info">Greetings %user.name_f% &mdash; your subscription expires on %expire|date%</div>';
@tarikhagustia
tarikhagustia / configure_docker0.sh
Created May 8, 2018 07:45 — forked from kamermans/configure_docker0.sh
Change the IP subnet of Docker's docker0 interface
#!/bin/sh -e
#
# You can run this script directly from github as root like this:
# curl -sS https://gist.githubusercontent.com/kamermans/94b1c41086de0204750b/raw/configure_docker0.sh | sudo bash -s - 192.168.254.1/24
#
# * Make sure you replace "192.168.254.0/24" with the network that you want to use
#
# NOTE: This script is intended for Debian / Ubuntu only!
if [ $# -lt 1 ]; then
## Based on: http://code.activestate.com/recipes/577654/
#!/usr/bin/env python
# Send DDE Execute command to running program
from ctypes import POINTER, WINFUNCTYPE, c_char_p, c_void_p, c_int, c_ulong, c_char_p
from ctypes.wintypes import BOOL, DWORD, BYTE, INT, LPCWSTR, UINT, ULONG
import time
# DECLARE_HANDLE(name) typedef void *name;
HCONV = c_void_p # = DECLARE_HANDLE(HCONV)