Examples of AuthenticatedPrincipal


Examples of org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal

        principal.getName());
  }

  @Test
  public void testAuthenticateBadUser() {
    AuthenticatedPrincipal principal = this.authenticator.authenticate("foo", PASSWORD);
    assertNull(principal);
  }
View Full Code Here

Examples of org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal

    assertNull(principal);
  }

  @Test
  public void testAuthenticateBadPassword() {
    AuthenticatedPrincipal principal =
        this.authenticator.authenticate(this.resourceOwner.getUsername(), "bad");
    assertNull(principal);
  }
View Full Code Here

Examples of org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal

  private AuthorizationRequest createAuthRequest(String implicitGrantResponseType) {
    AuthorizationRequest authRequest = new AuthorizationRequest();
    Client client = new Client();
    authRequest.setClient(client);
    authRequest.setResponseType(implicitGrantResponseType);
    authRequest.setPrincipal(new AuthenticatedPrincipal("sammy sammy"));
    authRequest.setRedirectUri("http://localhost:8080");
    authRequest.setState("important");
    return authRequest;
  }
View Full Code Here

Examples of org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal

  public void testSerialization() throws IOException {
    Map<String, String> attributes = new HashMap<String, String>();
    attributes.put("key", "value");
    String identityProvider = "http://universiteit-hardewijk";
    String displayName = "gebruiker.pi";
    AuthenticatedPrincipal principal = new SAMLAuthenticatedPrincipal("ud.id.name.pi", Arrays.asList(new String[]{"USER", "ADMIN"}), attributes, Arrays.asList(new String[]{"id.group.1", "id.group.2", "id.group.3"}), identityProvider, displayName, true);
    String json = principal.serialize();
    SAMLAuthenticatedPrincipal samlPrincipal = (SAMLAuthenticatedPrincipal) AuthenticatedPrincipal.deserialize(json);
    assertTrue(samlPrincipal.isGroupAware());
    assertEquals(identityProvider, samlPrincipal.getIdentityProvider());
    assertEquals(displayName, samlPrincipal.getDisplayName());
    assertTrue(samlPrincipal.isAdminPrincipal());
View Full Code Here

Examples of org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal

    save(authReq, repo);
    authReq.setPrincipal(getPrincipal());
    repo.save(authReq);

    AuthorizationRequest authReqSaved = repo.findByAuthState(authState);
    AuthenticatedPrincipal principal = authReqSaved.getPrincipal();
    assertEquals("foo-university", principal.getAttributes().get("organization"));

  }
View Full Code Here

Examples of org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal

  private AuthenticatedPrincipal getPrincipal() {
    List<String> roles = Arrays.asList(new String[] { "user", "admin" });
    Map<String, String> attributes = new HashMap<String, String>();
    attributes.put("organization", "foo-university");
    return new AuthenticatedPrincipal("john.doe", roles, attributes);
  }
View Full Code Here

Examples of org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal

  public void principal() {
    final ClientResponse response = webResource.path("principal").header("Authorization", authorizationBearer(ACCESS_TOKEN))
            .get(ClientResponse.class);
    assertEquals(200, response.getStatus());

    AuthenticatedPrincipal principal = response.getEntity(AuthenticatedPrincipal.class);
    assertEquals("admin-enduser",principal.getName());
  }
View Full Code Here

Examples of org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal

  @Before
  public void before() throws Exception {
    MockitoAnnotations.initMocks(this);
    VerifyTokenResponse verifyTokenResponse = new VerifyTokenResponse();
    verifyTokenResponse.setPrincipal(new AuthenticatedPrincipal("user"));
    verifyTokenResponse.setScopes(Arrays.asList("read"));
    when(request.getAttribute(AuthorizationServerFilter.VERIFY_TOKEN_RESPONSE)).thenReturn(verifyTokenResponse);
  }
View Full Code Here

Examples of org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal

  @Test
  public void scopesShouldBeSubsetOfResourceServerScopes() {

    Client client = new Client();
    request.setAttribute(AuthorizationServerFilter.VERIFY_TOKEN_RESPONSE, new VerifyTokenResponse("",
        new ArrayList<String>(), new AuthenticatedPrincipal("user"), 0L));
    client.setScopes(Arrays.asList("Some", "arbitrary", "set"));
    client.setName("clientname");
    ResourceServer resourceServer = new ResourceServer();
    resourceServer.setScopes(Arrays.asList("read", "update", "delete"));
    when(resourceServerRepository.findByIdAndOwner(1L, "user")).thenReturn(resourceServer);
View Full Code Here

Examples of org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal

  @Before
  public void before() {
    MockitoAnnotations.initMocks(this);
    VerifyTokenResponse verifyTokenResponse = new VerifyTokenResponse();
    verifyTokenResponse.setPrincipal(new AuthenticatedPrincipal("user"));
    verifyTokenResponse.setScopes(Arrays.asList("read"));
    when(request.getAttribute(AuthorizationServerFilter.VERIFY_TOKEN_RESPONSE)).thenReturn(verifyTokenResponse);
  }
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.