Saturday, March 28, 2020

Kotlin + OAuth2 + JWT + SpringBoot2 + JPA

I share example how to integrate Kotlin + OAuth2 + Spring Rest API + SpringBoot 2  + JWT +JPA.

Technologies used:

1. Spring Boot 2.2.6.RELEASE
2. Maven
3. OAuth2
4. Intellij IDEA Community
5. Spring Tools Suite (STS) 4
6. MySql
7. Postman

Code on GitHub:


Create table on MySql:

 `id`       INT(11) NOT NULL auto_increment, 
 `username` VARCHAR(255) NOT NULL, 
 `password` VARCHAR(255) NOT NULL, 
  PRIMARY KEY (`id`) 

I saved the password field with Security - Password Enconding (

VALUES      (1, 

IntelliJ:  File -> open --> choose folder backend

Change the configuration on file application.yml

Run project from IntelliJ :

View -> Tool Windows -> Maven -> Execute Maven Goal-> mvn install

Run project backend.jar with java -jar backend.jar,  in the file configuration you can define context for application, i define context --> backend and port 9000.

Credencials for test:

Test: Get token

Test: Error when you try to access ws, you need to add access_token

Add access_token -> url?access_token=your_token.


Wednesday, March 25, 2020

Configure Tomcat reverseproxy https to http

If your site using https and you need to access http tomcat, you need to make reverseproxy.

Edit file conf/server.xml and add yellow paragraph:

<Connector port="8080" protocol="HTTP/1.1"
               proxyName="" scheme="https" secure="true" proxyPort="443" />

Restart tomcat.

Try again.


Thursday, March 19, 2020

GIT Tips

1.  Install git

sudo apt install git

2. create file .ssh

sudo mkdir /home/your_user/.ssh  

3. On folder .ssh run next command, (enter and enter doesn't write anything).


4. copy content on file

cat /home/your_user/.ssh/

5. Open in your browser GitHub or GitLab

GitHub:  -> New SSH key

GitLab:https://your_ip_or_hostname/profile/keys --> Add and SSH Key

6. Clone branch or specific branch

Any branch:
git clone <remote-repo>
Specific branch:
git clone --single-branch --branch <branchname> <remote-repo>

8. Discard unstaged changes

git stash

9. Git Checkout Specific file

git checkout <branch_name> -- <paths>

10. Override comment in commit

git commit --amend -m "My_new_comment"

11. Remove local commits

git reset --hard origin/<branch_name>

12. To rollback to commit

git reset --hard sha1_id

13. Create GitHub Branch from Commit

Clone the Repository:
git clone
cd your-repository
Find the Commit Hash:
git log
Create a New Branch:
git checkout -b new-branch-name commit-hash
Push the New Branch to GitHub:
git push origin new-branch-name

14. Long path file:

git config --system core.longpaths true

Wednesday, March 4, 2020

Please check if the configured key or specified key file is a valid SSH Private Key - Rancher Kubernetes

Solution next error Rancher on Centos8:

Please check if the configured key or specified key file is a valid SSH Private Key. Error: Error configuring SSH: ssh: no key found



Save the key of your nodes on workstation.

Step 1 — Create the RSA Key Pair


Enter and enter doesn't write anything.

Step 2 — Copy the Public Key to CentOS Server

ssh-copy-id username@remote_host

Copying Public Key Using SSH

cat ~/.ssh/ | ssh username@remote_host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"

Check connect with ssh without password.


Multiple Data Sources in Spring Boot 3 with Java 21

  In this blog post, we'll explore the configuration and setup for a Spring Boot 3 application with Java 21 that uses multiple data sour...