Commit 61d35974 authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

No commit message

No commit message
parent 2e81bce0
package de.dariah.aai.javasp.web.controller;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.security.core.Authentication;
......@@ -12,10 +8,8 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.web.bind.annotation.ModelAttribute;
import de.dariah.aai.javasp.base.Role;
import de.dariah.aai.javasp.base.SimpleUserDetails;
import de.dariah.samlsp.model.pojo.AuthPojo;
import eu.dariah.de.minfba.core.web.controller.BaseTranslationController;
......@@ -57,7 +51,7 @@ public abstract class BaseSecurityController extends BaseTranslationController {
AuthPojo pojo = null;
if (user != null) {
pojo = new AuthPojo();
pojo.setAuth(true);
pojo.setAuth(user.isAccountNonExpired() && user.isAccountNonLocked() && user.isCredentialsNonExpired() && user.isEnabled());
pojo.setDisplayName(user.getUsername());
pojo.setRoles(new ArrayList<String>());
if (user.getAuthorities()!=null) {
......@@ -77,7 +71,7 @@ public abstract class BaseSecurityController extends BaseTranslationController {
AuthPojo pojo = null;
if (user!=null) {
pojo = new AuthPojo();
pojo.setAuth(true);
pojo.setAuth(user.isAccountNonExpired() && user.isAccountNonLocked() && user.isCredentialsNonExpired() && user.isEnabled());
pojo.setDisplayName(user.getUsername());
pojo.setRoles(new ArrayList<String>());
if (user.getAuthorities()!=null) {
......@@ -91,8 +85,8 @@ public abstract class BaseSecurityController extends BaseTranslationController {
private AuthPojo handleAnonymousLocalUser(Authentication auth) {
AuthPojo pojo = new AuthPojo();
pojo.setAuth(true);
pojo.setDisplayName("Anonymous local user");
pojo.setAuth(false);
pojo.setDisplayName("Anonymous user");
pojo.setRoles(new ArrayList<String>());
if (auth.getAuthorities()!=null) {
for (GrantedAuthority authority : auth.getAuthorities()) {
......
Supports Markdown
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