当前位置: 首页>>代码示例>>Java>>正文


Java OAuthEncoder.decode方法代码示例

本文整理汇总了Java中org.scribe.utils.OAuthEncoder.decode方法的典型用法代码示例。如果您正苦于以下问题:Java OAuthEncoder.decode方法的具体用法?Java OAuthEncoder.decode怎么用?Java OAuthEncoder.decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.scribe.utils.OAuthEncoder的用法示例。


在下文中一共展示了OAuthEncoder.decode方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAccessTokenExtractor

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
    return new AccessTokenExtractor() {
        
        @Override
        public Token extract(String response) {
            Preconditions.checkEmptyString(response, "Response body is incorrect. Can't extract a token from an empty string");
 
            Matcher matcher = Pattern.compile("\"access_token\" : \"([^&\"]+)\"").matcher(response);
            if (matcher.find())
            {
              String token = OAuthEncoder.decode(matcher.group(1));
              return new Token(token, "", response);
            } 
            else
            {
              throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null);
            }
        }
    };
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:22,代码来源:Google2Api.java

示例2: getAccessTokenExtractor

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
    return new AccessTokenExtractor() {
        
        @Override
        public Token extract(String response) {
            Preconditions.checkEmptyString(response, "Response body is incorrect. Can't extract a token from an empty string");

            Matcher matcher = Pattern.compile("\"access_token\" : \"([^&\"]+)\"").matcher(response);
            if (matcher.find())
            {
              String token = OAuthEncoder.decode(matcher.group(1));
              return new Token(token, "", response);
            } 
            else
            {
              throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null);
            }
        }
    };
}
 
开发者ID:elimu-ai,项目名称:webapp,代码行数:22,代码来源:Google2Api.java

示例3: getAccessTokenExtractor

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
    return new AccessTokenExtractor() {
        
        @Override
        public Token extract(String response) {
        	
            Preconditions.checkEmptyString(response, "Response body is incorrect. Can't extract a token from an empty string");
            
            // We are not interested in access_token - we and the JWT encrypted token
            // Matcher matcher = Pattern.compile("\"access_token\" : \"([^&\"]+)\"").matcher(response);
            Matcher matcher = Pattern.compile("\"id_token\" : \"([^&\"]+)\"").matcher(response);
            if (matcher.find()) {
            	String token = OAuthEncoder.decode(matcher.group(1));
            	return new Token(token, "", response);
            } else {
            	throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null);
            }
        }
    };
}
 
开发者ID:tahamsaglam,项目名称:duckdns,代码行数:22,代码来源:Google2Api.java

示例4: getAccessTokenExtractor

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor()
{
    return new AccessTokenExtractor()
    {

        @Override
        public Token extract( String response )
        {
            Preconditions.checkEmptyString( response, "Response body is incorrect. Can't extract a token from an empty string" );

            Matcher matcher = Pattern.compile( "\"access_token\" : \"([^&\"]+)\"" ).matcher( response );
            if ( matcher.find() )
            {
                String token = OAuthEncoder.decode( matcher.group( 1 ) );
                return new Token( token, "", response );
            }
            else
            {
                throw new OAuthException( "Response body is incorrect. Can't extract a token from this: '" + response + "'", null );
            }
        }
    };
}
 
开发者ID:iTwenty,项目名称:Hashtagger,代码行数:25,代码来源:Google2Api.java

示例5: getAccessTokenExtractor

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
    return new AccessTokenExtractor() {

        @Override
        public Token extract(String response) {
            Preconditions.checkEmptyString(response, "Response body is incorrect. Can't extract a token from an empty string");

            Matcher matcher = Pattern.compile("\"access_token\" : \"([^&\"]+)\"").matcher(response);
            if (matcher.find())
            {
                String token = OAuthEncoder.decode(matcher.group(1));
                return new Token(token, "", response);
            }
            else
            {
                throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null);
            }
        }
    };
}
 
开发者ID:kurukurupapa,项目名称:TryAndroid,代码行数:22,代码来源:Google2Api.java

示例6: getAccessTokenExtractor

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
public AccessTokenExtractor getAccessTokenExtractor() {
    return new AccessTokenExtractor() {
        
        @Override
        public Token extract(String response) {
            Preconditions.checkEmptyString(response, "Response body is incorrect. Can't extract a token from an empty string");

            Matcher matcher = Pattern.compile("\"access_token\" : \"([^&\"]+)\"").matcher(response);
            if (matcher.find())
            {
              String token = OAuthEncoder.decode(matcher.group(1));
              return new Token(token, "", response);
            } 
            else
            {
              throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null);
            }
        }
    };
}
 
开发者ID:muquit,项目名称:gwtoauthlogindemo,代码行数:21,代码来源:Google2Api.java

示例7: extractToken

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
private static String extractToken(String name, String responseBody) {
    try {
        Preconditions.checkEmptyString(name, "name String is incorrect!");
        Preconditions.checkEmptyString(responseBody, "Response body is incorrect. Can't extract a token from an empty string");
    } catch (IllegalArgumentException e) {
        throw new OAuthException(e.getMessage());
    }

    //{"access_token" : ""}
    String REGEX = "\"%s\"\\s*:\\s*\"([^\"]+)\"";
    REGEX = String.format(REGEX, name);

    Matcher matcher = Pattern.compile(REGEX).matcher(responseBody);
    if (matcher.find()) {
        return OAuthEncoder.decode(matcher.group(1));
    } else {
        throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + responseBody + "'", null);
    }
}
 
开发者ID:massimozappino,项目名称:tagmycode-java-sdk,代码行数:20,代码来源:TagMyCodeServiceImpl.java

示例8: extract

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
private static String extract(String response, Pattern p) {
    Matcher matcher = p.matcher(response);
    if (matcher.find() && matcher.groupCount() >= 1) {
        return OAuthEncoder.decode(matcher.group(1));
    } else {
        throw new OAuthException("Response body is incorrect. Can't extract token and secret from this: " + response);
    }
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:9,代码来源:EvernoteOAuthHelper.java

示例9: extract

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
private String extract(String response, Pattern p) {
  Matcher matcher = p.matcher(response);
  if (matcher.find() && matcher.groupCount() >= 1) {
    return OAuthEncoder.decode(matcher.group(1));
  } else {
    throw new OAuthException("Response body is incorrect. " +
        "Can't extract token and secret from this: '" + response + "'", null);
  }
}
 
开发者ID:duanze,项目名称:PureNote,代码行数:10,代码来源:EvernoteAuthToken.java

示例10: checkError

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
private static void checkError(CharSequence response) {
	Matcher matcher = ERROR_MESSAGE_REGEX.matcher(response);
	if (matcher.find() && matcher.groupCount() >= 1)
	{
		throw new OAuthException(OAuthEncoder.decode(matcher.group(1)));
	}
}
 
开发者ID:arcao,项目名称:Trackables,代码行数:8,代码来源:CustomTokenExtractorImpl.java

示例11: addQuerystring

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
public void addQuerystring(String queryString)
{
  if (queryString != null && queryString.length() > 0)
  {
    for (String param : queryString.split(PARAM_SEPARATOR))
    {
      String pair[] = param.split(PAIR_SEPARATOR);
      String key = OAuthEncoder.decode(pair[0]);
      String value = pair.length > 1 ? OAuthEncoder.decode(pair[1]) : EMPTY_STRING;
      params.add(new Parameter(key, value));
    }
  }
}
 
开发者ID:visun,项目名称:scribeoauth,代码行数:14,代码来源:ParameterList.java

示例12: extract

import org.scribe.utils.OAuthEncoder; //导入方法依赖的package包/类
private String extract(String response, Pattern p) {
    Matcher matcher = p.matcher(response);
    if (matcher.find() && matcher.groupCount() >= 1) {
        return OAuthEncoder.decode(matcher.group(1));
    } else {
        throw new OAuthException(
                "Response body is incorrect. Can't extract token and secret from this: '"
                        + response + "'", null);
    }
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:11,代码来源:TwitterButton.java


注:本文中的org.scribe.utils.OAuthEncoder.decode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。