Examples of AuthenticatedPrincipal


Examples of org.apache.qpid.server.security.auth.AuthenticatedPrincipal

        else if(_exclusive == ExclusivityPolicy.PRINCIPAL)
        {
            String owner = MapValueConverter.getStringAttribute(Queue.OWNER, attributes, null);
            if(owner != null)
            {
                _exclusiveOwner = new AuthenticatedPrincipal(owner);
            }
        }
        else if(_exclusive == ExclusivityPolicy.CONTAINER)
        {
            String owner = MapValueConverter.getStringAttribute(Queue.OWNER, attributes, null);
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticatedPrincipal

        setVirtualHost(virtualHost);
    }

    private void setTestAuthorizedSubject()
    {
        Principal principal = new AuthenticatedPrincipal(new UsernamePrincipal("InternalTestProtocolSession"));
        Subject authorizedSubject = new Subject(
                true,
                Collections.singleton(principal),
                Collections.emptySet(),
                Collections.emptySet());
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticatedPrincipal

            }
        }

        if(!_attributes.containsKey(CREATED_BY))
        {
            final AuthenticatedPrincipal currentUser = SecurityManager.getCurrentUser();
            if(currentUser != null)
            {
                _attributes.put(CREATED_BY, currentUser.getName());
            }
        }
        if(!_attributes.containsKey(CREATED_TIME))
        {
            _attributes.put(CREATED_TIME, System.currentTimeMillis());
View Full Code Here

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

  @Override
  public void authenticate(HttpServletRequest request, HttpServletResponse response, FilterChain chain,
      String authStateValue, String returnUri) throws IOException, ServletException {
    HttpSession session = request.getSession(false);
    AuthenticatedPrincipal principal = (AuthenticatedPrincipal) (session != null ? session
        .getAttribute(SESSION_IDENTIFIER) : null);
    if (request.getMethod().equals("POST")) {
      processForm(request);
      chain.doFilter(request, response);
    } else if (principal != null) {
View Full Code Here

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

   * @param request
   *          the {@link HttpServletRequest}
   */
  protected void processForm(final HttpServletRequest request) {
    setAuthStateValue(request, request.getParameter(AUTH_STATE));
    AuthenticatedPrincipal principal = new AuthenticatedPrincipal(request.getParameter("j_username"));
    request.getSession().setAttribute(SESSION_IDENTIFIER, principal);
    setPrincipal(request, principal);
  }
View Full Code Here

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

    return request.getMethod().equals(HttpMethod.POST.toString()) && StringUtils.isNotBlank(oauthApproval);
  }

  private void processInitial(HttpServletRequest request, ServletResponse response, FilterChain chain,
      String returnUri, String authStateValue, Client client) throws IOException, ServletException {
    AuthenticatedPrincipal principal = (AuthenticatedPrincipal) request.getAttribute(AbstractAuthenticator.PRINCIPAL);
    List<AccessToken> tokens = accessTokenRepository.findByResourceOwnerIdAndClient(principal.getName(), client);
    if (!CollectionUtils.isEmpty(tokens)) {
      // If another token is already present for this resource owner and client, no new consent should be requested
      List<String> grantedScopes = tokens.get(0).getScopes(); // take the scopes of the first access token found.
      setGrantedScopes(request, grantedScopes.toArray(new String[grantedScopes.size()]));
      chain.doFilter(request, response);
View Full Code Here

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

    client = repo.save(client);


    // Create an access token
    AccessToken at = new AccessToken("mytoken", new AuthenticatedPrincipal("username"), client, 0, null);
    at = accessTokenRepository.save(at);
    assertEquals(at, accessTokenRepository.findOne(at.getId()));

    // Create an authorization request
    AuthorizationRequest ar = new AuthorizationRequest("foo", "faa", "boo", null, "boo", "boo");
View Full Code Here

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

*/
public class AccessTokenTest {

  @Test
  public void marshallToJsonShouldHideSomeMembers() throws JAXBException {
    AccessToken token = getToken(new AuthenticatedPrincipal("Truus"));
    token.setClient(createClient("my-client-id", "my-client-secret"));

    String json = marshallToJson(token);

    assertTrue(json.contains("my-client-id"));
View Full Code Here

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

    client.setSecret(secret);
    return client;
  }

  private String generateEncodedPrincipal(String name, Collection<String> roles) {
    AuthenticatedPrincipal principal = new AuthenticatedPrincipal(name, roles);
    AccessToken token = getToken(principal);
    token.encodePrincipal();
    return token.getEncodedPrincipal();
  }
View Full Code Here

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

    when(resourceOwnerRepository.findByUsername(this.resourceOwner.getUsername())).thenReturn(resourceOwner);
  }

  @Test
  public void testAuthenticate() {
    AuthenticatedPrincipal principal =
        this.authenticator.authenticate(this.resourceOwner.getUsername(), PASSWORD);
    assertNotNull(principal);
    assertEquals("Principal does not have expected name", this.resourceOwner.getUsername(),
        principal.getName());
  }
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.