Examples of TaggingCredential


Examples of org.corrib.treemaps.source.TaggingCredential

   * @see org.corrib.s3b.sscf.exports.BookmarksExport#checkCredentials()
   */
  @Override
  protected void checkCredentials() throws BadCredentialsException {
    // load user's credentials from database
    TaggingCredential userCredentials = UserCredentials.getUserCredentials(user, bookmarkingSource);

    // then check them on delicious
    flickr.setCredentials(userCredentials);

    setMessage(TaskStatusInfo.CHECKED.getMessage());
View Full Code Here

Examples of org.corrib.treemaps.source.TaggingCredential

   * @param bookmarkingSource <tt>BookmarkingSource</tt> what source to get credentials for
   * @return <tt>TaggingCredentials</tt> credentials of the given user for the given bookmarking source
   * @throws BadCredentialsException when user's credentials where not found
   */
  public TaggingCredential loadCredentials(String sscfPerson, BookmarkingSource bookmarkingSource) throws BadCredentialsException{
    TaggingCredential credentials = null;
    Person person = PersonFactory.getPerson(sscfPerson);
    String[] encryptedCredentials = readFromStorage(person,bookmarkingSource);
    if(person != null && encryptedCredentials != null){
      String mbox_sha1sum = person.getMbox_sha1sum();
      PBEKeySpec keySpec = new PBEKeySpec(mbox_sha1sum.toCharArray());
      try {
        BASE64Decoder decoder = new BASE64Decoder();
       
        SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
        PBEParameterSpec paramSpec = new PBEParameterSpec(loginSalt, ITERATIONS);   
        cipher.init(Cipher.DECRYPT_MODE, secretKey,paramSpec);
        String secretLogin = URLDecoder.decode(encryptedCredentials[0],"UTF-8");
        byte[] loginBytes = cipher.doFinal(decoder.decodeBuffer(secretLogin));
        String login = new String(loginBytes);
       
       
        paramSpec = new PBEParameterSpec(passwordSalt,ITERATIONS);
        cipher.init(Cipher.DECRYPT_MODE,secretKey,paramSpec);
        String secretPassword = URLDecoder.decode(encryptedCredentials[1],"UTF-8");
        byte[] passwordBytes = cipher.doFinal(decoder.decodeBuffer(secretPassword));
        String password = new String(passwordBytes);
       
        credentials = new TaggingCredential(bookmarkingSource.getType(),login,password);
       
        addToMap(sscfPerson,credentials);
        return credentials;
      } catch (InvalidKeySpecException e) {
        logger.severe(e.getMessage());
View Full Code Here

Examples of org.corrib.treemaps.source.TaggingCredential

   * @return <tt>TaggingCredentials</tt> for the given user or <tt>null</tt> if they were not loaded yet
   * @throws <tt>BadCredentialsException</tt> when user's credentials where not found
   */
  public static TaggingCredential getUserCredentials(String sscfPerson, BookmarkingSource bookmarkingSource) throws BadCredentialsException{
    String id = bookmarkingSource.getType() + " : " + sscfPerson;
    TaggingCredential credentials;
    if(credentialsMap.get(id) != null)
      credentials = credentialsMap.get(id);
    else
      credentials = UserCredentials.getInstance().loadCredentials(sscfPerson, bookmarkingSource);
    return credentials;
View Full Code Here

Examples of org.corrib.treemaps.source.TaggingCredential

   * @throws BadCredentialsException when user login/password is incorrect
   */
  public static BookmarksSynchronization getBookmarksSynchronization(BookmarkingSource bookmarkingSource,String _sscfPerson, String serviceAddress) throws ParserConfigurationException, BadCredentialsException{
   
    BookmarksSynchronization bs = null;
    TaggingCredential tc = UserCredentials.getUserCredentials(_sscfPerson, bookmarkingSource);
    String _login = null;
    String _password = null;
    if(tc != null){
      _login = tc.getLogin();
      _password = tc.getPassword();
    }
    switch(bookmarkingSource){
    case FLICKR :
      bs = new FlickrBookmarksSynchronization(new FlickrTaggingSource(FlickrAPIPropertiesLoader.getInstance().getApiProperties(serviceAddress)),_login,_password,_sscfPerson);
      break;
View Full Code Here

Examples of org.corrib.treemaps.source.TaggingCredential

  }

  @Override
  public boolean credentialsCheck() {
    try {
      ((ProfiledTaggingSource) taggingSource).setCredentials(new TaggingCredential(BookmarkingSource.FLICKR.getType(), login, password));
      credentialsOK = true;
      return true;
    } catch (BadCredentialsException e) {
      logger.severe(e.getMessage());
      return false;
View Full Code Here

Examples of org.corrib.treemaps.source.TaggingCredential

   *
   * @see org.corrib.s3b.sscf.imports.BookmarksImport#credentialsCheck()
   */
  @Override
  public boolean credentialsCheck() {
    TaggingCredential tc = new TaggingCredential(BookmarkingSource.FLICKR
        .getSourceServerURI(), this.login, this.password);

    try {
      fts.setApiProperties(apiProperties);
      fts.setCredentials(tc);
View Full Code Here

Examples of org.corrib.treemaps.source.TaggingCredential

   */
  @Override
  public boolean credentialsCheck() {
    //as this is a ProfiledTagginSource perform credentlials check
    try {
      ((ProfiledTaggingSource)taggingSource).setCredentials(new TaggingCredential(BookmarkingSource.DEL_ICIO_US.getType(),login,password));
      credentialsOK = true;
      return true;
    } catch (BadCredentialsException e) {
      logger.severe(e.getMessage());
      return false;
View Full Code Here

Examples of org.corrib.treemaps.source.TaggingCredential

   */
  @Override
  public boolean credentialsCheck()
  {
    if(!isCredentialsOK()) {
      TaggingCredential tc = new TaggingCredential(BookmarkingSource.DEL_ICIO_US.getSourceServerURI(),this.login,this.password);
     
      try
      {
        this.dts.setCredentials(tc);
        //if credentials were ok store them for use in synchronization later on
View Full Code Here

Examples of org.corrib.treemaps.source.TaggingCredential

  @Override
  protected void checkCredentials() throws BadCredentialsException {

    // load user's credentials from database
    TaggingCredential userCredentials = UserCredentials.getUserCredentials(user, bookmarkingSource);

    // then check them on delicious
    delicious.setCredentials(userCredentials);

    setMessage(TaskStatusInfo.CHECKED.getMessage());
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.