public Principal getPrincipal() { return sc.getUserPrincipal(); } @Override
public final Principal getUserPrincipal() { SecurityContext ctx = (SecurityContext)getMessageContext().get(SecurityContext.class.getName()); if (ctx == null) { return null; } return ctx.getUserPrincipal(); }
AuthorizationPolicy policy = sc.getUserPrincipal() == null ? new AuthorizationPolicy() : new PrincipalAuthorizationPolicy(sc); policy.setUserName(username); if (sc.getUserPrincipal() != null) { AuthorizationPolicy policy = new PrincipalAuthorizationPolicy(sc); policy.setAuthorization(credentials);
public Principal getPrincipal() { return sc.getUserPrincipal(); } @Override
protected String getUserName(Crypto crypto, Message message) { SecurityContext sc = message.get(SecurityContext.class); if (sc != null && sc.getUserPrincipal() != null) { return sc.getUserPrincipal().getName(); } return RSSecurityUtils.getUserName(crypto, null); }
public Principal getUserPrincipal() { org.apache.cxf.security.SecurityContext sc = getInternalSecurityContext(); return sc == null ? null : sc.getUserPrincipal(); }
protected String getUserName(Crypto crypto, Message message) { SecurityContext sc = message.get(SecurityContext.class); if (sc != null && sc.getUserPrincipal() != null) { return sc.getUserPrincipal().getName(); } return RSSecurityUtils.getUserName(crypto, null); }
public final Principal getUserPrincipal() { SecurityContext ctx = (SecurityContext)getMessageContext().get(SecurityContext.class.getName()); if (ctx == null) { return null; } return ctx.getUserPrincipal(); }
@GET @Produces("text/html") public LogoutResponse logout(@CookieParam(SSOConstants.SECURITY_CONTEXT_TOKEN) Cookie context, @Context SecurityContext sc) { doLogout(context, sc); // Use View Handler to tell the user that the logout has been successful, // optionally listing the user login name and/or linking to the main application address, // the user may click on it, will be redirected to IDP and the process will start again return new LogoutResponse(sc.getUserPrincipal().getName(), mainApplicationAddress); }
private void doLogout(Cookie context, SecurityContext sc) { if (context == null || sc.getUserPrincipal() == null || sc.getUserPrincipal().getName() == null) { reportError("MISSING_RESPONSE_STATE"); throw ExceptionUtils.toBadRequestException(null, null); } stateProvider.removeResponseState(context.getValue()); }
@Override protected boolean isUserInRole(SecurityContext sc, List<String> roles, boolean deny) { Principal principal = sc.getUserPrincipal(); if (principal instanceof SAMLTokenPrincipal) { SAMLTokenPrincipal samlPrincipal = (SAMLTokenPrincipal)principal; SamlAssertionWrapper assertion = samlPrincipal.getToken(); String role = getRoleFromAssertion(assertion); if (roles.contains(role)) { return true; } } return false; }
protected SecurityContext getAndValidateSecurityContext(MultivaluedMap<String, String> params) { SecurityContext securityContext = (SecurityContext)getMessageContext().get(SecurityContext.class.getName()); if (securityContext == null || securityContext.getUserPrincipal() == null) { throw ExceptionUtils.toNotAuthorizedException(null, null); } checkTransportSecurity(); return securityContext; } protected UserSubject createUserSubject(SecurityContext securityContext,
protected SecurityContext getAndValidateSecurityContext(MultivaluedMap<String, String> params) { SecurityContext securityContext = (SecurityContext)getMessageContext().get(SecurityContext.class.getName()); if (securityContext == null || securityContext.getUserPrincipal() == null) { throw ExceptionUtils.toNotAuthorizedException(null, null); } checkTransportSecurity(); return securityContext; }
protected SecurityContext getAndValidateSecurityContext(MultivaluedMap<String, String> params) { SecurityContext securityContext = (SecurityContext)getMessageContext().get(SecurityContext.class.getName()); if (securityContext == null || securityContext.getUserPrincipal() == null) { throw ExceptionUtils.toNotAuthorizedException(null, null); } checkTransportSecurity(); return securityContext; } protected UserSubject createUserSubject(SecurityContext securityContext,
protected SecurityContext getAndValidateSecurityContext(MultivaluedMap<String, String> params) { SecurityContext securityContext = (SecurityContext)getMessageContext().get(SecurityContext.class.getName()); if (securityContext == null || securityContext.getUserPrincipal() == null) { throw ExceptionUtils.toNotAuthorizedException(null, null); } checkTransportSecurity(); return securityContext; }
@Override public void handleMessage(SoapMessage msg) throws Fault { SecurityToken token = msg.get(SecurityToken.class); SecurityContext context = msg.get(SecurityContext.class); if (token == null || context == null || context.getUserPrincipal() == null) { super.handleMessage(msg); return; } UsernameToken ut = (UsernameToken)token; Subject subject = createSubject(ut.getName(), ut.getPassword(), ut.isHashed(), ut.getNonce(), ut.getCreatedTime()); SecurityContext sc = doCreateSecurityContext(context.getUserPrincipal(), subject); msg.put(SecurityContext.class, sc); }
public void handleMessage(Message message) throws Fault { Method method = getTargetMethod(message); SecurityContext sc = message.get(SecurityContext.class); if (sc != null && sc.getUserPrincipal() != null) { if (authorize(sc, method)) { return; } } else if (!isMethodProtected(method) && isAllowAnonymousUsers()) { return; } throw new AccessDeniedException("Unauthorized"); }
public void handleMessage(Message message) throws Fault { Method method = getTargetMethod(message); SecurityContext sc = message.get(SecurityContext.class); if (sc != null && sc.getUserPrincipal() != null) { if (authorize(sc, method)) { return; } } else if (!isMethodProtected(method) && isAllowAnonymousUsers()) { return; } throw new AccessDeniedException("Unauthorized"); }
public void handleMessage(Message message) throws Fault { Method method = getTargetMethod(message); SecurityContext sc = message.get(SecurityContext.class); if (sc != null && sc.getUserPrincipal() != null) { if (authorize(sc, method)) { return; } } else if (!isMethodProtected(method) && isAllowAnonymousUsers()) { return; } throw new AccessDeniedException("Unauthorized"); }
public void handleMessage(Message message) throws Fault { Method method = getTargetMethod(message); SecurityContext sc = message.get(SecurityContext.class); if (sc != null && sc.getUserPrincipal() != null) { if (authorize(sc, method)) { return; } } else if (!isMethodProtected(method) && isAllowAnonymousUsers()) { return; } throw new AccessDeniedException("Unauthorized"); }