Added equals methods
This commit is contained in:
parent
fcfeaf0979
commit
43c967638b
@ -2,9 +2,6 @@ package com.vpr.server.controller;
|
|||||||
|
|
||||||
import com.vpr.server.data.User;
|
import com.vpr.server.data.User;
|
||||||
import com.vpr.server.repository.UserRepository;
|
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 {
|
public class AuthController {
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.vpr.server.controller;
|
package com.vpr.server.controller;
|
||||||
|
|
||||||
|
import com.vpr.server.dao.interfaces.EventDAO;
|
||||||
import com.vpr.server.data.Event;
|
import com.vpr.server.data.Event;
|
||||||
import com.vpr.server.data.User;
|
import com.vpr.server.data.User;
|
||||||
import com.vpr.server.data.UserEvent;
|
import com.vpr.server.data.UserEvent;
|
||||||
import com.vpr.server.dao.interfaces.EventDAO;
|
|
||||||
import com.vpr.server.json.JSONMapper;
|
import com.vpr.server.json.JSONMapper;
|
||||||
import com.vpr.server.json.Validator;
|
import com.vpr.server.json.Validator;
|
||||||
import com.vpr.server.repository.EventRepository;
|
import com.vpr.server.repository.EventRepository;
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package com.vpr.server.controller;
|
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.EventRepository;
|
||||||
import com.vpr.server.repository.UserEventRepository;
|
import com.vpr.server.repository.UserEventRepository;
|
||||||
import com.vpr.server.repository.UserRepository;
|
import com.vpr.server.repository.UserRepository;
|
||||||
@ -10,12 +7,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
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.server.ResponseStatusException;
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
import java.sql.Time;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
|
|
||||||
@Controller // This means that this class is a Controller
|
@Controller // This means that this class is a Controller
|
||||||
@RequestMapping(path = "/vpr") // This means URL's start with /demo (after Application path)
|
@RequestMapping(path = "/vpr") // This means URL's start with /demo (after Application path)
|
||||||
public class MainController {
|
public class MainController {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.vpr.server.controller;
|
package com.vpr.server.controller;
|
||||||
|
|
||||||
import com.vpr.server.dao.interfaces.UserDAO;
|
import com.vpr.server.dao.interfaces.UserDAO;
|
||||||
import com.vpr.server.data.Event;
|
|
||||||
import com.vpr.server.data.User;
|
import com.vpr.server.data.User;
|
||||||
import com.vpr.server.json.JSONMapper;
|
import com.vpr.server.json.JSONMapper;
|
||||||
import com.vpr.server.repository.UserRepository;
|
import com.vpr.server.repository.UserRepository;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.vpr.server.dao.implementation;
|
package com.vpr.server.dao.implementation;
|
||||||
|
|
||||||
import com.vpr.server.dao.interfaces.UserDAO;
|
import com.vpr.server.dao.interfaces.UserDAO;
|
||||||
import com.vpr.server.data.Event;
|
|
||||||
import com.vpr.server.data.User;
|
import com.vpr.server.data.User;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.vpr.server.data;
|
|||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
// @Entity creates a table out of this class with Hibernate
|
// @Entity creates a table out of this class with Hibernate
|
||||||
// @Table defines the table-name
|
// @Table defines the table-name
|
||||||
|
@ -5,7 +5,6 @@ import com.vpr.server.data.User;
|
|||||||
import com.vpr.server.data.UserEvent;
|
import com.vpr.server.data.UserEvent;
|
||||||
|
|
||||||
import java.sql.Time;
|
import java.sql.Time;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package com.vpr.server.json;
|
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.Date;
|
||||||
import java.sql.Time;
|
import java.sql.Time;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -1,18 +1,11 @@
|
|||||||
package com.vpr.server.repository;
|
package com.vpr.server.repository;
|
||||||
|
|
||||||
import com.vpr.server.data.Event;
|
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.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
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 javax.transaction.Transactional;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
// This will be AUTO IMPLEMENTED by Spring into a Bean called eventRepository
|
// This will be AUTO IMPLEMENTED by Spring into a Bean called eventRepository
|
||||||
// CRUD refers Create, Read, Update, Delete
|
// CRUD refers Create, Read, Update, Delete
|
||||||
|
@ -4,11 +4,12 @@ import io.jsonwebtoken.JwtException;
|
|||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
import io.jsonwebtoken.SignatureAlgorithm;
|
import io.jsonwebtoken.SignatureAlgorithm;
|
||||||
import io.jsonwebtoken.security.Keys;
|
import io.jsonwebtoken.security.Keys;
|
||||||
|
|
||||||
import java.security.Key;
|
import java.security.Key;
|
||||||
|
|
||||||
public class Token {
|
public class Token {
|
||||||
|
|
||||||
private static Key KEY = Keys.secretKeyFor(SignatureAlgorithm.HS256);
|
private static final Key KEY = Keys.secretKeyFor(SignatureAlgorithm.HS256);
|
||||||
|
|
||||||
public static String Generate(String subject){
|
public static String Generate(String subject){
|
||||||
return Jwts.builder().setSubject(subject).signWith(KEY).compact();
|
return Jwts.builder().setSubject(subject).signWith(KEY).compact();
|
||||||
|
Loading…
Reference in New Issue
Block a user