Package com.eclipsesource.jaxrs.provider.security

Examples of com.eclipsesource.jaxrs.provider.security.AuthorizationHandler


public class SecurityContextImplTest {
 
  @Test
  public void testIsInRoleIsUsesAuthorizationHandler_True() {
    AuthorizationHandler handler = mock( AuthorizationHandler.class );
    when( handler.isUserInRole( any( Principal.class ), anyString() ) ).thenReturn( true );
    SecurityContextImpl context = new SecurityContextImpl( SecurityContext.BASIC_AUTH, mock( Principal.class ), false, handler );
   
    boolean isUserInRole = context.isUserInRole( "foo" );
   
    assertTrue( isUserInRole );
View Full Code Here


    assertTrue( isUserInRole );
  }
 
  @Test
  public void testIsInRoleIsUsesAuthorizationHandler_False() {
    AuthorizationHandler handler = mock( AuthorizationHandler.class );
    when( handler.isUserInRole( any( Principal.class ), anyString() ) ).thenReturn( false );
    SecurityContextImpl context = new SecurityContextImpl( SecurityContext.BASIC_AUTH, mock( Principal.class ), false, handler );
   
    boolean isUserInRole = context.isUserInRole( "foo" );
   
    assertFalse( isUserInRole );
View Full Code Here

public class SecurityAdmin {

  public SecurityContext getSecurityContext( ContainerRequestContext requestContext ) {
    SecurityContext result = null;
    AuthenticationHandler authenticationHandler = Activator.getInstance().getAuthenticationHandler();
    AuthorizationHandler authorizationHandler = Activator.getInstance().getAuthorizationHandler();
    if( authenticationHandler != null && authorizationHandler != null ) {
      result = createSecurityContext( requestContext, authenticationHandler, authorizationHandler );
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.jaxrs.provider.security.AuthorizationHandler

Copyright © 2018 www.massapicom. 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.