Examples of Authentication


Examples of org.geomajas.security.Authentication

    Assert.assertTrue(securityContext.isAttributeReadable(LAYER_ID, feature, ATTRIBUTE_ID));
    Assert.assertFalse(securityContext.isAttributeWritable(LAYER_ID, feature, ATTRIBUTE_ID));
  }

  private Authentication getAuthentication(int which) {
    Authentication auth = new Authentication();
    auth.setAuthorizations(
        new BaseAuthorization[] {which == 1 ? new AllowAllAuthorization() : new AllowNoneAuthorization()});
    auth.setSecurityServiceId(SECURITY_SERVICE_ID + which);
    auth.setUserId(USER_ID);
    return auth;
  }
View Full Code Here

Examples of org.geomajas.security.Authentication

    auth.setUserId(USER_ID);
    return auth;
  }

  private Authentication getAttributeAuthentication() {
    Authentication auth = new Authentication();
    auth.setAuthorizations(new BaseAuthorization[]{new TestAuthorization()});
    auth.setSecurityServiceId(SECURITY_SERVICE_ID);
    auth.setUserId(USER_ID);
    return auth;
  }
View Full Code Here

Examples of org.geomajas.security.Authentication

      return !"wri".equals(feature.getAttributes().get(attribute).getValue());
    }
  }

  private Authentication getFeatureAuthentication() {
    Authentication auth = new Authentication();
    auth.setAuthorizations(new BaseAuthorization[]{new TestFeatureAuthorization()});
    auth.setSecurityServiceId(SECURITY_SERVICE_ID);
    auth.setUserId(USER_ID);
    return auth;
  }
View Full Code Here

Examples of org.geomajas.security.Authentication

  @Test
  public void testAuthorizedOne() {
    SecurityContextImpl securityContext = new SecurityContextImpl();
    List<Authentication> authentications = new ArrayList<Authentication>();
    Authentication authentication;
    authentication = new Authentication();
    authentication.setAuthorizations(
        new BaseAuthorization[]{new AllowAllAuthorization(), new AllowNoneAuthorization()});
    authentications.add(authentication);
    securityContext.setAuthentications("token", authentications);
    Assert.assertTrue(securityContext.isToolAuthorized(TOOL_ID));
    Assert.assertTrue(securityContext.isCommandAuthorized(COMMAND_NAME));
View Full Code Here

Examples of org.geomajas.security.Authentication

  @Test
  public void testAuthorizedOther() {
    SecurityContextImpl securityContext = new SecurityContextImpl();
    List<Authentication> authentications = new ArrayList<Authentication>();
    Authentication authentication;
    authentication = new Authentication();
    authentication.setAuthorizations(
        new BaseAuthorization[]{new AllowNoneAuthorization(), new AllowAllAuthorization()});
    authentications.add(authentication);
    securityContext.setAuthentications("token", authentications);
    Assert.assertTrue(securityContext.isToolAuthorized(TOOL_ID));
    Assert.assertTrue(securityContext.isCommandAuthorized(COMMAND_NAME));
View Full Code Here

Examples of org.geomajas.security.Authentication

  @Test
  public void testAuthorizedTwoAuthentications() {
    SecurityContextImpl securityContext = new SecurityContextImpl();
    List<Authentication> authentications = new ArrayList<Authentication>();
    Authentication authentication;
    authentication = new Authentication();
    authentication.setAuthorizations(new BaseAuthorization[]{new AllowNoneAuthorization()});
    authentications.add(authentication);
    authentication = new Authentication();
    authentication.setAuthorizations(new BaseAuthorization[]{new AllowAllAuthorization()});
    authentications.add(authentication);
    securityContext.setAuthentications("token", authentications);
    Assert.assertTrue(securityContext.isToolAuthorized(TOOL_ID));
    Assert.assertTrue(securityContext.isCommandAuthorized(COMMAND_NAME));
    Assert.assertTrue(securityContext.isLayerVisible(LAYER_ID));
View Full Code Here

Examples of org.geomajas.security.Authentication

  @Test
  @DirtiesContext
  public void testSameUser() {
    SecurityContextImpl context = new SecurityContextImpl();
    List<Authentication> authentications = new ArrayList<Authentication>();
    Authentication auth1 = getAuthentication();
    Authentication auth2 = getAuthentication();
    auth2.setSecurityServiceId("ss2");
    authentications.add(auth1);
    authentications.add(auth2);
    context.setAuthentications("token", authentications);
    Assert.assertEquals("AllowAll@ss|AllowAll@ss2",context.getId());
    Assert.assertEquals(USER_ID,context.getUserId());
View Full Code Here

Examples of org.geomajas.security.Authentication

    Assert.assertEquals(null, context.getUserOrganization());
    Assert.assertEquals(null, context.getUserDivision());
  }

  private Authentication getAuthentication() {
    Authentication auth = new Authentication();
    auth.setAuthorizations(new BaseAuthorization[]{new AllowAllAuthorization()});
    auth.setSecurityServiceId(SECURITY_SERVICE_ID);
    auth.setUserId(USER_ID);
    auth.setUserName(USER_NAME);
    auth.setUserLocale(USER_LOCALE);
    auth.setUserOrganization(USER_ORGANIZATION);
    auth.setUserDivision(USER_DIVISION);
    return auth;
  }
View Full Code Here

Examples of org.geomajas.security.Authentication

  @Test
  @DirtiesContext // setting SecurityContext
  public void testNoFilters() {
    SecurityContextImpl securityContext = (SecurityContextImpl)this.securityContext;
    List<Authentication> authentications = new ArrayList<Authentication>();
    Authentication auth1 = getAuthentication();
    Authentication auth2 = getAuthentication();
    auth2.setSecurityServiceId("ss2");
    authentications.add(auth1);
    authentications.add(auth2);
    securityContext.setAuthentications("token", authentications);
    Assert.assertNull(securityContext.getFeatureFilter(LAYER_ID));
  }
View Full Code Here

Examples of org.geomajas.security.Authentication

  @Test
  public void testOneFilter() {
    SecurityContextImpl securityContext = (SecurityContextImpl)this.securityContext;
    List<Authentication> authentications = new ArrayList<Authentication>();
    Authentication auth1 = getAuthentication();
    Authentication auth2 = getFilterAuthentication();
    auth2.setSecurityServiceId("ss2");
    authentications.add(auth1);
    authentications.add(auth2);
    securityContext.setAuthentications("token", authentications);
    Filter filter = securityContext.getFeatureFilter(LAYER_ID);
    Assert.assertNotNull(filter);
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.