Pular para o conteúdo principal

Postagens

Mostrando postagens de dezembro, 2019

Microblog application using Quarkus and template (Qute)

Quarkus 1.1 was released and in the announcement  surprisingly a new template extension was mentioned: Qute . Qute was made for Quarkus: it works in dev mode and you can compile to native image using Graal. In this post I will share the application I created to test the template engine. How Qute works with Quarkus? Qute works like very other Quarkus extension: convention over configuration and simple setup. It has support for custom tags and the template language is very simple. You can place templates in resource/templates and then inject them in your code. So if you have: src/main/resources/templates/productTemplate.html You can inject it using: @Inject io.quarkus.qute.Template productTemplate; Later you can create instances from this template passing variables and return them in JAX-RS methods. Yes, you can use JAX-RS as controller:       @GET     @Produces(MediaType.TEXT_HTML)     public TemplateInstance getProductsHtm...

Quarkus Application with Form Authentication using Database

Let's create a simple Quarkus application that uses databases table for authorization and authentication. This tutorial uses MariaDB and Quarkus 1.1.0.Final. Database configuration Remember to NEVER store plain text in the database. Elytron has the tools to use bcrypt for password encryption as described in the Quarkus JDBC security guide . We need to configure the database tables where the user, password and roles will be stored. Let's create the tables in the database: * User table keeps the username and password; * Roles is where you can find all the system roles; * User_role is user mapping to their roles Which translated to the following SQL: create table user(id int primary key,                              username varchar(100) unique,                              password varchar(1000)); create table role(i...