Examples of SecurityContextImpl


Examples of com.porterhead.rest.authorization.impl.SecurityContextImpl

        String requestDateString = request.getHeaderValue(HEADER_DATE);
        String nonce = request.getHeaderValue(HEADER_NONCE);
        AuthorizationRequestContext context = new AuthorizationRequestContext(request.getPath(), request.getMethod(),
                            requestDateString, nonce, authToken);
        ExternalUser externalUser = authorizationService.authorize(context);
        request.setSecurityContext(new SecurityContextImpl(externalUser));
        return request;
    }
View Full Code Here

Examples of com.porterhead.rest.authorization.impl.SecurityContextImpl

    @Test(expected = InvalidAuthorizationHeaderException.class)
    public void authenticationFailure() {
        User user = new User();
        user.setRole(Role.authenticated);
        ExternalUser externalUser = null;
        SecurityContext context = new SecurityContextImpl(externalUser);
        context.isUserInRole(Role.authenticated.name());
    }
View Full Code Here

Examples of com.porterhead.rest.authorization.impl.SecurityContextImpl

        context.isUserInRole(Role.authenticated.name());
    }

    @Test(expected = InvalidAuthorizationHeaderException.class)
    public void nullSession() {
        SecurityContext context = new SecurityContextImpl(null);
        context.isUserInRole(Role.authenticated.name());
    }
View Full Code Here

Examples of com.porterhead.rest.authorization.impl.SecurityContextImpl

    private SecurityContext createSecurityContext(Role role) {
        User user = new User();
        user.setRole(role);
        ExternalUser externalUser = new ExternalUser(user);
        SecurityContext context = new SecurityContextImpl(externalUser);
        return context;
    }
View Full Code Here

Examples of com.porterhead.rest.authorization.impl.SecurityContextImpl

*/
public abstract class SimpleSecurityFilter implements ContainerRequestFilter {

    public ContainerRequest filter(ContainerRequest request) {
        ExternalUser externalUser = new ExternalUser(getUser());
        request.setSecurityContext(new SecurityContextImpl(externalUser));
        return request;
    }
View Full Code Here

Examples of io.undertow.security.impl.SecurityContextImpl

    /**
     * @see io.undertow.server.HttpHandler#handleRequest(io.undertow.server.HttpServerExchange)
     */
    @Override
    public void handleRequest(HttpServerExchange exchange) throws Exception {
        SecurityContextImpl newContext = new SecurityContextImpl(exchange, authenticationMode, identityManager);
        if (programaticMechName != null) {
            newContext.setProgramaticMechName(programaticMechName);
        }
        exchange.putAttachment(SecurityContext.ATTACHMENT_KEY, newContext);
        HttpHandlers.executeHandler(next, exchange);
    }
View Full Code Here

Examples of org.acegisecurity.context.SecurityContextImpl

public class AcegiWorkflowContextHandlerInterceptorDifferentProviderTests extends AbstractWorkflowContextHandlerInterceptorTests {


  protected MockHttpServletRequest getMockRequest(String userName) {
    Authentication auth = new AnonymousAuthenticationToken(userName, userName, new GrantedAuthority[]{ new GrantedAuthorityImpl(userName) });
    SecurityContext context = new SecurityContextImpl();
    context.setAuthentication(auth);
    SecurityContextHolder.setContext(context);

    return new MockHttpServletRequest();
  }
View Full Code Here

Examples of org.acegisecurity.context.SecurityContextImpl


  protected MockHttpServletRequest getMockRequest(String userName) {
    User user = new User(userName, "dummy", true, true, true, true, new GrantedAuthority[]{});
    Authentication auth = new UsernamePasswordAuthenticationToken(user, null);
    SecurityContext context = new SecurityContextImpl();
    context.setAuthentication(auth);
    SecurityContextHolder.setContext(context);

    return new MockHttpServletRequest();
  }
View Full Code Here

Examples of org.acegisecurity.context.SecurityContextImpl

        assertTrue(validate(new Person(30, "Steven"), text));
    }

    public void testParser39InRoleRule() {

        SecurityContext context = new SecurityContextImpl();
        GrantedAuthority[] roles = new GrantedAuthority[] { new GrantedAuthorityImpl("ADMIN_ROLE"),
                new GrantedAuthorityImpl("USER_ROLE") };
        context.setAuthentication(new TestingAuthenticationToken("username", "username", roles));
        SecurityContextHolder.setContext(context);

        String text = "{firstName: inRole('USER_ROLE') == true : 'Current user must be in USER_ROLE'}";
        assertTrue(validate(new Person(30, "Steven"), text));
    }
View Full Code Here

Examples of org.acegisecurity.context.SecurityContextImpl

  public void setUp() {
    GrantedAuthority[] roles = new GrantedAuthority[]{new GrantedAuthorityImpl("manager"), new GrantedAuthorityImpl("vp")};

    Authentication authentication = new UsernamePasswordAuthenticationToken(new Object(), new Object(), roles);

    SecurityContext context = new SecurityContextImpl();
    context.setAuthentication(authentication);

    SecurityContextHolder.setContext(context);

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.