Compare commits

..

No commits in common. "5cdab5b434cc6763785c3f7e44019dd20f5216ce" and "24794e2085f59ec70ebeb7ad9b47572c58e4e964" have entirely different histories.

10 changed files with 27 additions and 7 deletions

View File

@ -2,6 +2,9 @@ package com.vpr.server.controller;
import com.vpr.server.data.User;
import com.vpr.server.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
public class AuthController {

View File

@ -1,9 +1,9 @@
package com.vpr.server.controller;
import com.vpr.server.dao.interfaces.EventDAO;
import com.vpr.server.data.Event;
import com.vpr.server.data.User;
import com.vpr.server.data.UserEvent;
import com.vpr.server.dao.interfaces.EventDAO;
import com.vpr.server.json.JSONMapper;
import com.vpr.server.json.Validator;
import com.vpr.server.repository.EventRepository;

View File

@ -1,5 +1,8 @@
package com.vpr.server.controller;
import com.vpr.server.data.Event;
import com.vpr.server.data.User;
import com.vpr.server.data.UserEvent;
import com.vpr.server.repository.EventRepository;
import com.vpr.server.repository.UserEventRepository;
import com.vpr.server.repository.UserRepository;
@ -7,12 +10,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
import java.sql.Time;
import java.text.SimpleDateFormat;
@Controller // This means that this class is a Controller
@RequestMapping(path = "/vpr") // This means URL's start with /demo (after Application path)
public class MainController {

View File

@ -1,6 +1,7 @@
package com.vpr.server.controller;
import com.vpr.server.dao.interfaces.UserDAO;
import com.vpr.server.data.Event;
import com.vpr.server.data.User;
import com.vpr.server.json.JSONMapper;
import com.vpr.server.repository.UserRepository;

View File

@ -1,6 +1,7 @@
package com.vpr.server.dao.implementation;
import com.vpr.server.dao.interfaces.UserDAO;
import com.vpr.server.data.Event;
import com.vpr.server.data.User;
import org.springframework.stereotype.Repository;

View File

@ -2,6 +2,7 @@ package com.vpr.server.data;
import javax.persistence.*;
import java.sql.Date;
import java.util.Calendar;
// @Entity creates a table out of this class with Hibernate
// @Table defines the table-name

View File

@ -5,6 +5,7 @@ import com.vpr.server.data.User;
import com.vpr.server.data.UserEvent;
import java.sql.Time;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,5 +1,9 @@
package com.vpr.server.json;
import com.vpr.server.data.UserEvent;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import java.sql.Date;
import java.sql.Time;
import java.text.SimpleDateFormat;

View File

@ -1,11 +1,18 @@
package com.vpr.server.repository;
import com.vpr.server.data.Event;
import com.vpr.server.data.UserEvent;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import javax.persistence.ColumnResult;
import javax.persistence.ConstructorResult;
import javax.persistence.NamedNativeQuery;
import javax.persistence.SqlResultSetMapping;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Optional;
// This will be AUTO IMPLEMENTED by Spring into a Bean called eventRepository
// CRUD refers Create, Read, Update, Delete

View File

@ -4,12 +4,11 @@ import io.jsonwebtoken.JwtException;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.security.Keys;
import java.security.Key;
public class Token {
private static final Key KEY = Keys.secretKeyFor(SignatureAlgorithm.HS256);
private static Key KEY = Keys.secretKeyFor(SignatureAlgorithm.HS256);
public static String Generate(String subject){
return Jwts.builder().setSubject(subject).signWith(KEY).compact();