public String getUserName() { try { return ejbContext.getCallerPrincipal() != null ? ejbContext.getCallerPrincipal().getName() : null; } catch (Exception e) { e.printStackTrace(); } return null; } }
@RolesAllowed("architect") public String getUserName() { try { return ejbContext.getCallerPrincipal() != null ? ejbContext.getCallerPrincipal().getName() : null; } catch (Exception e) { e.printStackTrace(); } return null; }
/** * Find out who/what called this method * * @return */ private DatawavePrincipal getPrincipal() { DatawavePrincipal dp = null; Principal p = ctx.getCallerPrincipal(); if (p instanceof DatawavePrincipal) { dp = (DatawavePrincipal) p; } return dp; }
private DatawavePrincipal getPrincipal() { Principal p = ctx.getCallerPrincipal(); if (p instanceof DatawavePrincipal) { return (DatawavePrincipal) p; } throw new IllegalArgumentException("Principal must be of the correct type"); }
@Stateless public class EntityManagerService { @Resource EJBContext ejbContext; @Produces public EntityManager produceEM() { EntityManagerFactory managerFactory = Persistence.createEntityManagerFactory(ejbContext.getCallerPrincipal().getName()); return managerFactory.createEntityManager(); } }
private DatawavePrincipal getPrincipal() { Principal p = ctx.getCallerPrincipal(); if (p instanceof DatawavePrincipal) { return (DatawavePrincipal) p; } log.warn("Principal is not of the correct type"); return null; }
@Override public String getName() { return context.getCallerPrincipal().getName(); }
/** * {@inheritDoc} */ @Override protected String getUser() { if (context != null) { Principal principal = context.getCallerPrincipal(); if (principal != null) { return principal.getName(); } } return null; }
/** * {@inheritDoc} */ @Override protected String getUser() { if (context != null) { Principal principal = context.getCallerPrincipal(); if (principal != null) { return principal.getName(); } } return null; }
/** * {@inheritDoc} */ @Override protected String getPrincipal() { if (context != null) { return InterceptorUtil.getPrincipalName(context.getCallerPrincipal()); } return null; }
public Collection<String> getCurrentProxyServers() { Set<String> currentProxyServers = null; Principal p = context.getCallerPrincipal(); if (p != null && p instanceof DatawavePrincipal) { currentProxyServers = ((DatawavePrincipal) p).getProxyServers(); } return currentProxyServers; } }
public void requestBegin(String id) { Pair<Principal,Thread> connectionRequestPair = new Pair<>(ctx.getCallerPrincipal(), Thread.currentThread()); getConnectionThreadMap.put(id, connectionRequestPair); }
public static final Principal getPrincipal() { EJBContext context = ThreadLocalServiceSecurityManager.get(); if (context == null) { return null; } return context.getCallerPrincipal(); }
public Principal getUserPrincipal() { EJBContext ejbContext = getAttachment(EJBContext.class); Principal principal = ejbContext.getCallerPrincipal(); return principal; }
public boolean cancelConnectionRequest(String id) { return cancelConnectionRequest(id, ctx.getCallerPrincipal()); }
public Object updateVersion(EntityEnterpriseContext ctx) { Object value = ctx.getEJBContext().getCallerPrincipal().getName(); setInstanceValue(ctx, value); return value; } }
public void setFirstVersion(EntityEnterpriseContext ctx) { setInstanceValue(ctx, ctx.getEJBContext().getCallerPrincipal().getName()); }
private Set<Authorizations> getAuths() { // Find out who/what called this method Principal p = ctx.getCallerPrincipal(); String sid = p.getName(); Collection<Collection<String>> cbAuths = new HashSet<>(); if (p instanceof DatawavePrincipal) { DatawavePrincipal cp = (DatawavePrincipal) p; sid = cp.getShortName(); cbAuths.addAll(cp.getAuthorizations()); } log.trace(sid + " has authorizations " + cbAuths); return AuthorizationsUtil.buildAuthorizations(cbAuths); }
public String getCurrentUserDN() { String currentUserDN = null; Principal p = context.getCallerPrincipal(); if (p != null && p instanceof DatawavePrincipal) { currentUserDN = ((DatawavePrincipal) p).getUserDN().subjectDN(); } return currentUserDN; }
public void persist(CachedRunningQuery crq, String owner) { synchronized (this) { log.debug("persisting cachedRunningQuery " + crq.getQueryId() + " to cache with status " + crq.getStatus()); this.cachedRunningQueryCache.remove(owner + "-" + crq.getQueryId()); this.cachedRunningQueryCache.remove(owner + "-" + crq.getAlias()); this.cachedRunningQueryCache.remove(owner + "-" + crq.getView()); this.cachedRunningQueryCache.put(owner + "-" + crq.getQueryId(), crq); this.cachedRunningQueryCache.put(owner + "-" + crq.getAlias(), crq); this.cachedRunningQueryCache.put(owner + "-" + crq.getView(), crq); log.debug("persisting cachedRunningQuery " + crq.getQueryId() + " to database with status " + crq.getStatus()); crq.saveToDatabase(ctx.getCallerPrincipal(), metricFactory); } }