List of usage examples for org.springframework.security.core Authentication getName
public String getName();
From source file:co.com.soinsoftware.altablero.utils.AuthenticationUtils.java
public static String getDocumentNumberFromAuthentication() { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); return auth.getName(); }
From source file:sample.data.jpa.utils.SecurityUtils.java
public static String getLoggedInUserName() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String name = authentication.getName(); return name;/*from www . j a va 2 s. c o m*/ }
From source file:org.socialsignin.springsocial.security.signin.AuthenticatedUserIdHolder.java
/** * @return The userId of the currently authenticated user * or null if the local user is anonymous *///from w w w . j av a 2s. c o m public static String getAuthenticatedUserId() { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); return auth == null || auth.getName().equals("anonymousUser") ? null : auth.getName(); }
From source file:reconf.server.ApplicationSecurity.java
public static boolean isRoot(Authentication auth) { return auth != null && StringUtils.equals(auth.getName(), ReConfConstants.SERVER_ROOT_USER); }
From source file:quanlyhocvu.api.web.util.Tools.java
public static String getCurrentUser() { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null) { return auth.getName(); }//from www .ja v a 2 s .c o m return null; }
From source file:org.appverse.web.framework.backend.security.xs.SecurityHelper.java
/** * Retrieves the authenticated principal from security context * @return the principal name// w w w . ja v a2 s. c o m */ public static String getPrincipal() { final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); return authentication.getName(); }
From source file:br.com.jreader.util.security.Session.java
public static String getUserSession() { SecurityContext context = SecurityContextHolder.getContext(); if (context instanceof SecurityContext) { Authentication authentication = context.getAuthentication(); if (authentication instanceof Authentication) { return authentication.getName(); }//from w w w . jav a 2s .c om } return null; }
From source file:dtu.ds.warnme.utils.SecurityUtils.java
public static String getCurrentUserUsername() { if (SecurityContextHolder.getContext() == null || SecurityContextHolder.getContext().getAuthentication() == null) { return null; }/*from www . ja v a2 s .co m*/ Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication.getName() == null) { throw new IllegalStateException("There is user authenticated without username?"); } return authentication.getName(); }
From source file:org.appverse.web.framework.backend.api.helpers.security.SecurityHelper.java
public static String getPrincipal() { final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); return authentication.getName(); }
From source file:de.chludwig.websec.saml2sp.springconfig.CurrentUserHandlerMethodArgumentResolver.java
private static String getUserId(Authentication auth, SAMLCredential samlCredential) { return (samlCredential == null) ? auth.getName() : samlCredential.getNameID().getValue(); }