Commit 20734e6b authored by Andreas Gärtner's avatar Andreas Gärtner

Added authToken to User and a query to get a user by authToken.

parent 04bf330c
......@@ -15,10 +15,16 @@ public class User {
@Unique
@Column(name = "user_id")
private String userId;
@Column(name = "password")
private String password;
@Column(name = "is_admin")
private boolean isAdmin;
@Unique
@Column(name = "auth_token")
private String authToken;
public String getUserId() {
return userId;
......@@ -40,6 +46,14 @@ public class User {
public void setAdmin(boolean isAdmin) {
this.isAdmin = isAdmin;
}
public void setAuthToken(String authToken) {
this.authToken = authToken;
}
public String getAuthToken() {
return authToken;
}
@Override
public int hashCode() {
......
package de.thm.arsnova.connector.persistence.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import de.thm.arsnova.connector.persistence.domain.User;
@Repository
public interface UserRepository extends JpaRepository<User, String> {
@Query("select u from User u where u.authToken like %?1")
User findByToken(String authToken);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment