Package org.geomajas.security

Examples of org.geomajas.security.Authentication


  public String getId() {
    return "AllowAll";
  }

  public Authentication getAuthentication(String authenticationToken) {
    Authentication authentication = new Authentication();
    authentication.setUserId("anonymous");
    authentication.setAuthorizations(AUTHORIZATIONS);
    return authentication;
  }
View Full Code Here


    return "FIRST";
  }

  public Authentication getAuthentication(String authenticationToken) {
    if ("TEST".equals(authenticationToken)) {
      Authentication authentication = new Authentication();
      authentication.setUserId("test");
      authentication.setAuthorizations(new BaseAuthorization[]{ new AllowAllAuthorization()});
      return authentication;
    }
    if ("SECOND".equals(authenticationToken)) {
      Authentication authentication = new Authentication();
      authentication.setUserId("second");
      authentication.setAuthorizations(new BaseAuthorization[]{ new AllowAllAuthorization()});
      return authentication;
    }
    return null;
  }
View Full Code Here

    Assert.assertEquals("", testRecorder.matches(AllowNoneWiredAuthorization.GROUP,
        AllowNoneWiredAuthorization.VALUE));
  }

  private Authentication createTestAuthentication() {
    Authentication authentication = new Authentication();
    authentication.setAuthorizations(new BaseAuthorization[]{new AllowNoneWiredAuthorization()});
    return authentication;
  }
View Full Code Here

  public boolean createSecurityContext(String authenticationToken) {
    clearSecurityContext(); // assure there is no authenticated user in case of problems during creation
    List<SecurityService> services = securityInfo.getSecurityServices();
    List<Authentication> authentications = new ArrayList<Authentication>();
    for (SecurityService service : services) {
      Authentication auth = service.getAuthentication(authenticationToken);
      if (null != auth) {
        authentications.add(auth);
        auth.setSecurityServiceId(service.getId());
        if (!securityInfo.isLoopAllServices()) {
          break;
        }
      }
    }
View Full Code Here

    return "FIRST";
  }

  public Authentication getAuthentication(String authenticationToken) {
    if ("TEST".equals(authenticationToken)) {
      Authentication authentication = new Authentication();
      authentication.setUserId("test");
      authentication.setAuthorizations(new BaseAuthorization[]{ new AllowAllAuthorization()});
      return authentication;
    }
    return null;
  }
View Full Code Here

  @Test
  public void testSameUser() {
    SecurityContextImpl securityContext = new SecurityContextImpl();
    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.assertEquals("AllowAll@ss|AllowAll@ss2",securityContext.getId());
    Assert.assertEquals(USER_ID,securityContext.getUserId());
View Full Code Here

  @Test
  public void testDifferentUser() {
    SecurityContextImpl securityContext = new SecurityContextImpl();
    List<Authentication> authentications = new ArrayList<Authentication>();
    Authentication auth1 = getAuthentication();
    Authentication auth2 = getAuthentication();
    auth2.setUserId("bla");
    auth2.setUserName(null);
    auth2.setUserLocale(null);
    auth2.setUserDivision("Marketing");
    authentications.add(auth1);
    authentications.add(auth2);
    securityContext.setAuthentications("token", authentications);
    Assert.assertEquals("AllowAll@ss",securityContext.getId());
    Assert.assertEquals(USER_ID + ", bla", securityContext.getUserId());
View Full Code Here

  @Test
  public void testDifferentUser2() {
    SecurityContextImpl securityContext = new SecurityContextImpl();
    List<Authentication> authentications = new ArrayList<Authentication>();
    Authentication auth1 = getAuthentication();
    auth1.setUserName(null);
    auth1.setUserLocale(null);
    auth1.setUserOrganization(null);
    Authentication auth2 = getAuthentication();
    auth2.setUserName(null);
    auth2.setUserLocale(null);
    authentications.add(auth1);
    authentications.add(auth2);
    securityContext.setAuthentications("token", authentications);
    Assert.assertEquals("AllowAll@ss", securityContext.getId());
    Assert.assertEquals(USER_ID, securityContext.getUserId());
View Full Code Here

    Assert.assertEquals(USER_ORGANIZATION, securityContext.getUserOrganization());
    Assert.assertEquals(USER_DIVISION, securityContext.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

  @Test
  public void testDefaultVisibleArea() throws Exception {
    SecurityContextImpl securityContext = (SecurityContextImpl)this.securityContext;
    List<Authentication> authentications = new ArrayList<Authentication>();
    Authentication auth1 = getBaseAuthentication();
    authentications.add(auth1);
    securityContext.setAuthentications("token", authentications);
    Assert.assertTrue(securityContext.isLayerVisible(LAYER_ID));
    Geometry geometry = securityContext.getVisibleArea(LAYER_ID);
    Assert.assertNotNull(geometry);
View Full Code Here

TOP

Related Classes of org.geomajas.security.Authentication

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.