Tuesday, September 23, 2014

OAuth2.0 refresh token and access token


When we implement OAuth2, we have access token and refresh token. Why do we need both refresh token and access token? Using plain English, below are reasons in simplified version.


  • For security reason, OAuth2 has both refresh token and access token. access token is something close to one-time password, which is ideally secure. access token may be expired shortly. Refresh token may last for long time and even will not expire until it will be revoked. 


  • For performance and scalability reason, it better to verify HTTP request on the resource server instead of on central authorization server for every HTTP request.


  • Basically, access_token is kind of temporary password and refresh_token is pass to get temporary password from central authentication server. "temporary" password, access_token, is verified on resource server.

    Thursday, September 11, 2014

    install phpMyAdmin on CentOS 7

        1  yum update
        2  df
        3  yum -y install mariadb-server mariadb
        4  systemctl start mariadb.service
        5  systemctl enable mariadb.service
        6  mysql_secure_installation
        7  yum -y install httpd
        8  systemctl start httpd.service
        9  systemctl enable httpd.service
       10  firewall-cmd --permanent --zone=public --add-service=http 
       11  firewall-cmd --permanent --zone=public --add-service=https
       12  firewall-cmd --reload
       13  ifconfig 
       14  yum -y install php
       15  systemctl restart httpd.service
       16  cd /var/www/html/
       17  vi info.php
       18  yum -y install php-mysql
       19  yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
       20  cd /tmp/ 
       21  wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
       22  yum install epel-release-latest-7.noarch.rpm 
       23  yum install phpMyAdmin.noarch
    
    

    Wednesday, September 3, 2014

    install Oracle jdk on CentOS

    yum groupinstall -y development
    
    https://www.if-not-true-then-false.com/2014/install-oracle-java-8-on-fedora-centos-rhel/
    
    
    
    alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_65/jre/bin/java 200000
     alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_65/jre/bin/javaws 200000
    alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/lib/jvm/jdk1.7.0_65/jre/lib/amd64/libnpjp2.so 200000
    alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_65/bin/javac 200000
    alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_65/bin/jar 200000
    
    
    
    /usr/lib/jvm/jdk1.8.0_25
    
    alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_25/jre/bin/java 300000
    alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.8.0_25/jre/bin/javaws 300000
    alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/lib/jvm/jdk1.8.0_25/jre/lib/amd64/libnpjp2.so 300000
    alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_25/bin/javac 300000
    alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.8.0_25/bin/jar 300000
    alternatives --install /usr/bin/jvisualvm jvisualvm /usr/lib/jvm/jdk1.8.0_25/bin/jvisualvm 300000
    
    
    su -i 
    
    wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
    
    
    /usr/lib/jvm/jdk1.8.0_131
    
    alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_131/jre/bin/java 300000
    alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.8.0_131/jre/bin/javaws 300000
    alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/lib/jvm/jdk1.8.0_131/jre/lib/amd64/libnpjp2.so 300000
    alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_131/bin/javac 300000
    alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.8.0_131/bin/jar 300000
    alternatives --install /usr/bin/jvisualvm jvisualvm /usr/lib/jvm/jdk1.8.0_131/bin/jvisualvm 300000