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


Java AccessTokenExtractor类代码示例

本文整理汇总了Java中org.scribe.extractors.AccessTokenExtractor的典型用法代码示例。如果您正苦于以下问题:Java AccessTokenExtractor类的具体用法?Java AccessTokenExtractor怎么用?Java AccessTokenExtractor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getAccessTokenExtractor

import org.scribe.extractors.AccessTokenExtractor; //导入依赖的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.extractors.AccessTokenExtractor; //导入依赖的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.extractors.AccessTokenExtractor; //导入依赖的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.extractors.AccessTokenExtractor; //导入依赖的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.extractors.AccessTokenExtractor; //导入依赖的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.extractors.AccessTokenExtractor; //导入依赖的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: setUp

import org.scribe.extractors.AccessTokenExtractor; //导入依赖的package包/类
@Before
public void setUp() {
    try {
        api = mock(DefaultApi20.class);
        config = mock(OAuthConfig.class);
        request = mock(ProxyOAuthRequest.class);
        response = mock(Response.class);
        tokenExtractor = mock(AccessTokenExtractor.class);
        verifier = mock(Verifier.class);

        when(api.getAccessTokenExtractor()).thenReturn(tokenExtractor);
        when(request.send()).thenReturn(response);
        when(response.getBody()).thenReturn("body");
        when(verifier.getValue()).thenReturn("value");

        PowerMockito.whenNew(ProxyOAuthRequest.class).withAnyArguments().thenReturn(request);

    } catch (Exception ex) {
        Logger.getLogger(ProxyOAuthFIWARETest.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:22,代码来源:ProxyOAuthFIWARETest.java

示例8: getAccessTokenExtractor

import org.scribe.extractors.AccessTokenExtractor; //导入依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor()
{
    return new JsonTokenExtractor();
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:6,代码来源:WeiXinApi20.java

示例9: getAccessTokenExtractor

import org.scribe.extractors.AccessTokenExtractor; //导入依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
    return new JsonTokenExtractor();
}
 
开发者ID:jenkinsci,项目名称:bitbucket-build-status-notifier-plugin,代码行数:5,代码来源:BitbucketApi.java

示例10: getAccessTokenExtractor

import org.scribe.extractors.AccessTokenExtractor; //导入依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
    return new JsonTokenExtractor("\"token\":\\s*\"(\\S*?)\"");
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:YammerApi.java

示例11: getAccessTokenExtractor

import org.scribe.extractors.AccessTokenExtractor; //导入依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
	return new JsonTokenExtractor();
}
 
开发者ID:plekhotkindmytro,项目名称:Linkedin-oAuth2.0,代码行数:5,代码来源:LinkedInApi20.java

示例12: getAccessTokenExtractor

import org.scribe.extractors.AccessTokenExtractor; //导入依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
  return new JsonTokenExtractor();
}
 
开发者ID:davido,项目名称:gerrit-oauth-provider,代码行数:5,代码来源:KeycloakApi.java

示例13: getAccessTokenExtractor

import org.scribe.extractors.AccessTokenExtractor; //导入依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
  return new GoogleJsonTokenExtractor();
}
 
开发者ID:davido,项目名称:gerrit-oauth-provider,代码行数:5,代码来源:Google2Api.java

示例14: getAccessTokenExtractor

import org.scribe.extractors.AccessTokenExtractor; //导入依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
  return new BitbucketTokenExtractor();
}
 
开发者ID:davido,项目名称:gerrit-oauth-provider,代码行数:5,代码来源:BitbucketApi.java

示例15: getAccessTokenExtractor

import org.scribe.extractors.AccessTokenExtractor; //导入依赖的package包/类
@Override
public AccessTokenExtractor getAccessTokenExtractor() {
  return new GitLabJsonTokenExtractor();
}
 
开发者ID:davido,项目名称:gerrit-oauth-provider,代码行数:5,代码来源:GitLabApi.java


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