Examples of IApiKey


Examples of org.apache.wookie.beans.IApiKey

   * @throws SystemUnavailableException if there is a problem generating the key
   */
  public static void createKey(HttpServletRequest request, String email, Messages localizedMessages) throws SystemUnavailableException, EmailException {
     
      IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IApiKey key = persistenceManager.newInstance(IApiKey.class);
    key.setEmail(email);

    // generate a nonce
    RandomGUID r = new RandomGUID();
    String nonce = "nonce-" + r.toString();         //$NON-NLS-1$

    // now use SHA hash on the nonce       
    String hashKey = HashGenerator.getInstance().encrypt(nonce+email)

    // get rid of any chars that might upset a url...
    hashKey = hashKey.replaceAll("=", ".eq."); //$NON-NLS-1$ //$NON-NLS-2$
    hashKey = hashKey.replaceAll("\\?", ".qu."); //$NON-NLS-1$ //$NON-NLS-2$
    hashKey = hashKey.replaceAll("&", ".am."); //$NON-NLS-1$ //$NON-NLS-2$
    hashKey = hashKey.replaceAll("\\+", ".pl."); //$NON-NLS-1$ //$NON-NLS-2$

    key.setValue(hashKey);
    persistenceManager.save(key);
   
    String message = localizedMessages.getString("WidgetKeyManager.0")+hashKey+" \n"//$NON-NLS-1$//$NON-NLS-2$
    message+="\n" + localizedMessages.getString("WidgetKeyManager.1"); //$NON-NLS-1$ //$NON-NLS-2$
   
View Full Code Here

Examples of org.apache.wookie.beans.IApiKey

    values.put("email", email);
    if (persistenceManager.findByValues(IApiKey.class, values).length > 0){
      throw new ResourceDuplicationException();
    }
   
    IApiKey apiKey = persistenceManager.newInstance(IApiKey.class);
    apiKey.setValue(value);
    apiKey.setEmail(email);
    persistenceManager.save(apiKey);
    _logger.info("New API key registered for "+email);
    return true;
  }
View Full Code Here

Examples of org.apache.wookie.beans.IApiKey

  @Override
  protected boolean remove(String resourceId, HttpServletRequest request)
      throws ResourceNotFoundException, UnauthorizedAccessException,
      InvalidParametersException {
    IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IApiKey apiKey = persistenceManager.findById(IApiKey.class, resourceId);
    if (apiKey == null) throw new ResourceNotFoundException();
    persistenceManager.delete(apiKey);
    _logger.info("API key deleted for "+apiKey.getEmail());
    return true;
  }
View Full Code Here

Examples of org.apache.wookie.beans.IApiKey

               
                // ApiKey
                if (initializing && (persistenceManager.findAll(IApiKey.class).length == 0))
                {
                    // optional: create only if initializing
                    IApiKey apiKey = persistenceManager.newInstance(IApiKey.class);
                    apiKey.setValue("TEST");
                    apiKey.setEmail("test@127.0.0.1");
                    persistenceManager.save(apiKey);
                }
                else
                {
                    initializing = false;
View Full Code Here

Examples of org.apache.wookie.beans.IApiKey

   * @throws SystemUnavailableException if there is a problem generating the key
   */
  public static void createKey(HttpServletRequest request, String email, Messages localizedMessages) throws SystemUnavailableException, EmailException {
     
      IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IApiKey key = persistenceManager.newInstance(IApiKey.class);
    key.setEmail(email);

    // generate a nonce
    RandomGUID r = new RandomGUID();
    String nonce = "nonce-" + r.toString();         //$NON-NLS-1$

    // now use SHA hash on the nonce       
    String hashKey = HashGenerator.getInstance().encrypt(nonce+email)

    // get rid of any chars that might upset a url...
    hashKey = hashKey.replaceAll("=", ".eq."); //$NON-NLS-1$ //$NON-NLS-2$
    hashKey = hashKey.replaceAll("\\?", ".qu."); //$NON-NLS-1$ //$NON-NLS-2$
    hashKey = hashKey.replaceAll("&", ".am."); //$NON-NLS-1$ //$NON-NLS-2$
    hashKey = hashKey.replaceAll("\\+", ".pl."); //$NON-NLS-1$ //$NON-NLS-2$

    key.setValue(hashKey);
    persistenceManager.save(key);
   
    String message = localizedMessages.getString("WidgetKeyManager.0")+hashKey+" \n"//$NON-NLS-1$//$NON-NLS-2$
    message+="\n" + localizedMessages.getString("WidgetKeyManager.1"); //$NON-NLS-1$ //$NON-NLS-2$
   
View Full Code Here

Examples of org.apache.wookie.beans.IApiKey

   * @throws SystemUnavailableException if there is a problem generating the key
   */
  public static void createKey(HttpServletRequest request, String email, Messages localizedMessages) throws SystemUnavailableException, EmailException {
     
      IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
    IApiKey key = persistenceManager.newInstance(IApiKey.class);
    key.setEmail(email);

    // generate a nonce
    RandomGUID r = new RandomGUID();
    String nonce = "nonce-" + r.toString();         //$NON-NLS-1$

    // now use SHA hash on the nonce       
    String hashKey = HashGenerator.getInstance().encrypt(nonce+email)

    // get rid of any chars that might upset a url...
    hashKey = hashKey.replaceAll("=", ".eq."); //$NON-NLS-1$ //$NON-NLS-2$
    hashKey = hashKey.replaceAll("\\?", ".qu."); //$NON-NLS-1$ //$NON-NLS-2$
    hashKey = hashKey.replaceAll("&", ".am."); //$NON-NLS-1$ //$NON-NLS-2$
    hashKey = hashKey.replaceAll("\\+", ".pl."); //$NON-NLS-1$ //$NON-NLS-2$

    key.setValue(hashKey);
    persistenceManager.save(key);
   
    String message = localizedMessages.getString("WidgetKeyManager.0")+hashKey+" \n"//$NON-NLS-1$//$NON-NLS-2$
    message+="\n" + localizedMessages.getString("WidgetKeyManager.1"); //$NON-NLS-1$ //$NON-NLS-2$
   
View Full Code Here

Examples of org.apache.wookie.beans.IApiKey

                // ApiKey
                if (initializing && (persistenceManager.findAll(IApiKey.class).length == 0))
                {
                    // optional: create only if initializing
                    IApiKey apiKey = persistenceManager.newInstance(IApiKey.class);
                    apiKey.setValue("TEST");
                    apiKey.setEmail("test@127.0.0.1");
                    persistenceManager.save(apiKey);
                }
                else
                {
                    initializing = false;
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.