20 lines
421 B
Java
20 lines
421 B
Java
package de.mbremer.secutity;
|
|
|
|
import io.quarkus.security.identity.SecurityIdentity;
|
|
|
|
import javax.enterprise.context.RequestScoped;
|
|
import javax.inject.Inject;
|
|
|
|
@RequestScoped
|
|
public class UserService {
|
|
@Inject
|
|
SecurityIdentity identity;
|
|
|
|
/**
|
|
* Returns the user currently logged in.
|
|
*/
|
|
public User getCurrentUser() {
|
|
return User.find("username", identity.getPrincipal().getName()).singleResult();
|
|
}
|
|
}
|