Package org.apache.cxf.rs.security.oauth2.common

Examples of org.apache.cxf.rs.security.oauth2.common.Client


    protected Client getClient(String clientId) {
        if (clientId == null) {
            reportInvalidRequestError("Client ID is null");
            return null;
        }
        Client client = null;
        try {
            client = getValidClient(clientId);
        } catch (OAuthServiceException ex) {
            if (ex.getError() != null) {
                reportInvalidClient(ex.getError());
View Full Code Here


    }
   

    private static Client recreateClientInternal(String sequence) {
        String[] parts = getParts(sequence);
        Client c = new Client(parts[0],
                              parts[1],
                              Boolean.valueOf(parts[2]),
                              getStringPart(parts[3]), getStringPart(parts[4]));
        c.setApplicationDescription(getStringPart(parts[5]));
        c.setApplicationLogoUri(getStringPart(parts[6]));
        c.setApplicationCertificates(parseSimpleList(parts[7]));
        c.setAllowedGrantTypes(parseSimpleList(parts[8]));
        c.setRegisteredScopes(parseSimpleList(parts[9]));
        c.setRedirectUris(parseSimpleList(parts[10]));
        c.setRegisteredAudiences(parseSimpleList(parts[11]));
        c.setProperties(parseSimpleMap(parts[12]));
        c.setSubject(recreateUserSubject(parts[13]));
        return c;
    }
View Full Code Here

       
    }

    @Override
    public Client removeClient(String clientId) {
        Client c = getClient(clientId);
        clientCache.remove(clientId);
        return c;
    }
View Full Code Here

        clientsMap.put(client.getClientId(), ModelEncryptionSupport.encryptClient(client, key));
       
    }
    @Override
    public Client removeClient(String clientId) {
        Client client = getClient(clientId);
        clientsMap.remove(clientId);
        return client;
    }
View Full Code Here

      }
     
    String clientId = generateClientId(appName, appURI);
    String clientSecret = generateClientSecret();
 
    Client newClient = new Client(clientId, clientSecret, true, appName, appURI);
   
    newClient.setApplicationDescription(appDesc);
    newClient.setApplicationLogoUri(logoURI.toString());
    newClient.setRedirectUris(Collections.singletonList(appRedirectURI));
    manager.registerClient(newClient);
    return new ConsumerRegistration(clientId, clientSecret);
  }
View Full Code Here

      @FormParam("appURI") String appURI,
      @FormParam("appRedirectURI") String appRedirectURI) {
      String clientId = generateClientId(appName, appURI);
    String clientSecret = generateClientSecret();
 
    Client newClient = new Client(clientId, clientSecret, true, appName, appURI);
    newClient.setRedirectUris(Collections.singletonList(appRedirectURI));
    manager.registerClient(newClient);
    return new ConsumerRegistration(clientId, clientSecret);
  }
View Full Code Here

        validator.setDataProvider(dataProvider);
    }
   
    @Test
    public void testValidateAccessToken() throws Exception {
        MacAccessToken macAccessToken = new MacAccessToken(new Client("testClientId", "testClientSecret",
                                                                          false),
                                                                          HmacAlgorithm.HmacSHA256, -1);
        HttpServletRequest httpRequest = mockHttpRequest();
        UriInfo uriInfo = mockUriInfo();
       
View Full Code Here

     */
    protected Response startAuthorization(MultivaluedMap<String, String> params) {
        // Make sure the end user has authenticated, check if HTTPS is used
        SecurityContext sc = getAndValidateSecurityContext();
       
        Client client = getClient(params);
       
        // Validate the provided request URI, if any, against the ones Client provided
        // during the registration
        String redirectUri = validateRedirectUri(client, params.getFirst(OAuthConstants.REDIRECT_URI));
       
View Full Code Here

            throw new WebApplicationException(400);    
        }
        //TODO: additionally we can check that the Principal that got authenticated
        // in startAuthorization is the same that got authenticated in completeAuthorization
       
        Client client = getClient(params);
        String redirectUri = validateRedirectUri(client, params.getFirst(OAuthConstants.REDIRECT_URI));
       
        // Get the end user decision value
        String decision = params.getFirst(OAuthConstants.AUTHORIZATION_DECISION_KEY);
        boolean allow = OAuthConstants.AUTHORIZATION_DECISION_ALLOW.equals(decision);
View Full Code Here

        validator.setDataProvider(dataProvider);
    }
   
    @Test
    public void testValidateAccessToken() throws Exception {
        MacAccessToken macAccessToken = new MacAccessToken(new Client("testClientId", "testClientSecret",
                                                                          false),
                                                                          HmacAlgorithm.HmacSHA256, -1);
        HttpServletRequest httpRequest = mockHttpRequest();
        UriInfo uriInfo = mockUriInfo();
       
View Full Code Here

TOP

Related Classes of org.apache.cxf.rs.security.oauth2.common.Client

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.