This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.acme.getting.started; | |
import io.quarkus.runtime.*; | |
import io.quarkus.runtime.annotations.QuarkusMain; | |
import org.acme.getting.started.command.*; | |
import org.apache.maven.shared.utils.cli.CommandLineUtils; | |
import picocli.CommandLine; | |
import javax.inject.Inject; | |
@QuarkusMain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.acme.getting.started.data; | |
import io.quarkus.hibernate.orm.panache.PanacheEntityBase; | |
import javax.persistence.*; | |
@Entity | |
public class Setting extends PanacheEntityBase { | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
public Integer id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.acme.getting.started.command; | |
import org.acme.getting.started.data.Setting; | |
import picocli.CommandLine; | |
import javax.enterprise.context.Dependent; | |
import javax.transaction.Transactional; | |
@Dependent | |
@CommandLine.Command(name = "set") | |
public class SetCommand implements Runnable { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.quarkify.data; | |
public class Team { | |
public Long id; | |
public String name; | |
public User[] users; | |
public Team(Long id, String name, User... users) { | |
this.id = id; | |
this.name = name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private GraphQL createGraphQL() throws Exception { | |
TypeDefinitionRegistry teamsSchema = getTeamSchema(); | |
RuntimeWiring runtimeWiring = RuntimeWiring.newRuntimeWiring() | |
.type("Query", | |
builder -> builder.dataFetcher("allTeams", new VertxDataFetcher<>(this::getAllTeams)) | |
).build(); | |
SchemaGenerator schemaGenerator = new SchemaGenerator(); | |
GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(teamsSchema, runtimeWiring); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.quarkify; | |
import graphql.GraphQL; | |
import graphql.schema.*; | |
import graphql.schema.idl.*; | |
import io.vertx.core.Promise; | |
import io.vertx.ext.web.Router; | |
import io.vertx.ext.web.handler.graphql.*; | |
import net.quarkify.data.*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tech.donau.quarkify.security; | |
import org.eclipse.microprofile.jwt.Claims; | |
import org.jose4j.jws.AlgorithmIdentifiers; | |
import org.jose4j.jws.JsonWebSignature; | |
import org.jose4j.jwt.JwtClaims; | |
import org.jose4j.jwt.NumericDate; | |
import java.io.InputStream; | |
import java.security.KeyFactory; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tech.donau.quarkify.security; | |
public final class Roles { | |
private Roles() { } | |
public static final String USER = "User"; | |
public static final String SERVICE = "Service"; | |
public static final String ADMIN = "Admin"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tech.donau.quarkify.security; | |
import org.eclipse.microprofile.jwt.Claims; | |
import org.jboss.logmanager.Logger; | |
import org.jose4j.jwt.JwtClaims; | |
import javax.enterprise.context.RequestScoped; | |
import java.util.Arrays; | |
import java.util.UUID; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tech.donau.quarkify.data; | |
import io.quarkus.hibernate.orm.panache.PanacheEntity; | |
import javax.persistence.Entity; | |
@Entity | |
public class User extends PanacheEntity { | |
public String login; | |
public String email; | |
public String password; // Use e.g Bcrypt to encrypt password, don't store it as plain text :) |