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


Java SsoHandler类代码示例

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


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

示例1: sinaLoginClick

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
private void sinaLoginClick() {
    LetvLogApiTool.getInstance().saveExceptionInfo("sina登录开始 Current Time :" + StringUtils.getTimeStamp());
    if (NetworkUtils.isNetworkAvailable()) {
        LogInfo.LogStatistics("新浪微博注册");
        String pageId = this.mIsLoginPage ? PageIdConstant.loginPage : PageIdConstant.registerPage;
        StatisticsUtils.statisticsActionInfo(this.mActivity, pageId, "0", this.mIsLoginPage ? "c72" : "c82", null, 2, "ref=" + pageId + "_072_2");
        if (SinaWeiboUtils.isWeiboAppSupportAPI(this.mActivity, "3830215581", false)) {
            this.mWeiboAuth = new AuthInfo(this.mActivity, "3830215581", "http://m.letv.com", "email,direct_messages_read,direct_messages_write,friendships_groups_read,friendships_groups_write,statuses_to_me_read,follow_app_official_microblog,invitation_write");
            this.mSsoHandler = new SsoHandler(this.mActivity, this.mWeiboAuth);
            this.mSsoHandler.authorize(new AuthListener(this));
            return;
        }
        LetvOpenIDOAuthLoginActivity.launch(this.mActivity, ShareUtils.getSinaLoginUrl(), getResources().getString(2131100352));
        return;
    }
    ToastUtils.showToast(2131101012);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:ThirdPartLoginLayout.java

示例2: login

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
public void login(Activity activity, SsoHandler ssoHandler, final OnLoginListener loginListener) {
    this.loginListener = loginListener;
    if (loginListener == null)
        return;
    WbAuthHelper.auth(activity, ssoHandler, new WbAuthHelper.OnAuthOverListener() {
        @Override
        public void onAuth(Oauth2AccessToken token) {
            getUserInfo(token);
        }

        @Override
        public void onException(SocialException e) {
            loginListener.onFailure(e);
        }

        @Override
        public void onCancel() {
            loginListener.onCancel();
        }
    });
}
 
开发者ID:chendongMarch,项目名称:SocialSdkLibrary,代码行数:22,代码来源:WbLoginHelper.java

示例3: onCreate

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wb_login);
        ButterKnife.bind(this);

        if (BaseConfig.sAddAccountMode) {
            mTvMsg.setText(R.string.add_another_account);
        } else {
            mTvMsg.setText(R.string.has_not_logined);
        }
        // 快速授权时,请不要传入 SCOPE,否则可能会授权不成功
        // 高级授权
        mAuthInfo = new AuthInfo(this, SinaConsts.WEICO_APP_KEY, SinaConsts.WEICO_REDIRECT_URL,
                SinaConsts.SCOPE, SinaConsts.WEICO_PACKAGE_NAME);
        // 普通授权
//        mAuthInfo = new AuthInfo(this, SinaConsts.APP_KEY, SinaConsts.REDIRECT_URL,
//                SinaConsts.SCOPE, App.getInstance().getPackageName());
        mSsoHandler = new SsoHandler(this, mAuthInfo);
    }
 
开发者ID:liying2008,项目名称:Simpler,代码行数:21,代码来源:WBLoginActivity.java

示例4: onActivityResult

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);
	if (requestCode == Constants.REQUEST_LOGIN
			|| requestCode == Constants.REQUEST_APPBAR) {
		IUiListener listener = LoginByQQ.getmUiListener();
		if (listener != null) {
			Tencent.onActivityResultData(requestCode, resultCode, data,
					listener);
		}
	}
	SsoHandler ssoHandler = LoginByWB.getmSsoHandler();
	if (ssoHandler != null) {
		ssoHandler.authorizeCallBack(requestCode, resultCode, data);
	}
}
 
开发者ID:bigthing33,项目名称:LoginDemo,代码行数:17,代码来源:MainActivity.java

示例5: allInOneShare

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
private void allInOneShare(final WeiboMultiMessage weiboMessage) {
    final String token = getToken();
    if (TextUtils.isEmpty(token)) {
        mWeiboMessage = weiboMessage;
        Log.d(TAG, "authorize when allInOneShare");
        mSsoHandler = new SsoHandler((Activity) getContext());
        mSsoHandler.authorize(mAuthListener);
    } else {
        mWeiboMessage = null;
        mSsoHandler = null;
        doOnMainThread(new Runnable() {
            @Override
            public void run() {
                postProgressStart();
                Log.d(TAG, "share message when allInOneShare");
                mShareHandler.shareMessage(weiboMessage, false);
            }
        });
    }
}
 
开发者ID:Bilibili,项目名称:BiliShare,代码行数:21,代码来源:SinaShareHandler.java

示例6: weiboLogin

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
/**
 * 微博登陆
 */
private void weiboLogin(){
    mAuthInfo = new AuthInfo(this, Constants.WEIBO_APP_KEY, Constants.WEIBO_REDIRECT_URL, Constants.WEIBO_SCOPE);
    mSsoHandler = new SsoHandler(this, mAuthInfo);
    // Web授权
    //mSsoHandler.authorizeWeb(new LoginWeiboAuthListener());
    // SSO授权
    //mSsoHandler.authorizeClientSso(new LoginWeiboAuthListener());
    // All in one
    // 此种授权方式会根据手机是否安装微博客户端来决定使用sso授权还是网页授权,
    // 如果安装有微博客户端 则调用微博客户端授权,否则调用Web页面方式授权
    try {
        mSsoHandler.authorize(new LoginWeiboAuthListener());
    }catch (Exception e){
        Log.e(TAG, "weibo login exception: " + e.getMessage());
    }
}
 
开发者ID:zjupure,项目名称:SneezeReader,代码行数:20,代码来源:MainActivity.java

示例7: onCreate

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    Intent intent = getIntent();
    if(intent == null){
        finish();
        return;
    }
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setStatusBarTintResource(R.color.app_main_theme_color);
    }
    inflater = LayoutInflater.from(this);

    mTencent = Tencent.createInstance(Globe.QQ_APP_ID, this);
    mAuthInfo = new AuthInfo(this, Globe.SINA_APP_KEY, Globe.SINA_REDIRECT_URL, null);
    mSsoHandler = new SsoHandler(this, mAuthInfo);
    mIWeiboShareAPI =  WeiboShareSDK.createWeiboAPI(this, Globe.SINA_APP_KEY);
    mIWeiboShareAPI.registerApp();
}
 
开发者ID:x251089003,项目名称:EveryXDay,代码行数:24,代码来源:ToolbarControlDetailListViewActivity.java

示例8: init

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
protected void init() {
    // 设置Logo 1/4 处
    tvLoginTitle = (TextView) findViewById(R.id.tv_login_title);
    tvLoginTitle.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) tvLoginTitle.getLayoutParams();
            layoutParams.setMargins(0, Math.round(App.SCREEN_HEIGHT / 4f), 0, 0);
            tvLoginTitle.setLayoutParams(layoutParams);
        }
    });

    // 快速授权时,请不要传入 SCOPE,否则可能会授权不成功
    mAuthInfo = new AuthInfo(this, Constants.APP_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
    mSsoHandler = new SsoHandler(LoginActivity.this, mAuthInfo);

    // SSO 授权, 仅Web
    findViewById(R.id.btn_login).setOnClickListener(
        new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mSsoHandler.authorizeWeb(new AuthListener());
            }
        });
}
 
开发者ID:a464538715,项目名称:WeiBo_LH,代码行数:26,代码来源:LoginActivity.java

示例9: initLoginViews

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
private void initLoginViews() {
	TextView hintView = (TextView) findViewById(R.id.token_hint);
	hintView.setMovementMethod(new ScrollingMovementMethod());

	// 创建微博实例
	mWeiboAuth = new WeiboAuth(this, com.bpok.sina.sdk.Constants.APP_KEY,
			Constants.REDIRECT_URL, Constants.SCOPE);

	// 从 SharedPreferences 中读取上次已保存好 AccessToken 等信息,
	// 第一次启动本应用,AccessToken 不可用
	mAccessToken = AccessTokenKeeper.readAccessToken(this);
	if (mAccessToken.isSessionValid()) {
		updateTokenView(true);
	}

	loginButton = (LoginButton) findViewById(R.id.btn_login);
	loginButton.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View arg0) {
			mSsoHandler = new SsoHandler(Login.this, mWeiboAuth);
			mSsoHandler.authorize(new AuthListener());
		}
	});
}
 
开发者ID:NickAndroid,项目名称:SinaWeibo_Android,代码行数:26,代码来源:Login.java

示例10: WeiboLoginInstance

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
public WeiboLoginInstance(Activity activity, LoginListener listener, boolean fetchUserInfo) {
    super(activity, listener, fetchUserInfo);
    AuthInfo authInfo = new AuthInfo(activity, ShareManager.CONFIG.getWeiboId(),
            ShareManager.CONFIG.getWeiboRedirectUrl(), ShareManager.CONFIG.getWeiboScope());
    mSsoHandler = new SsoHandler(activity, authInfo);
    mLoginListener = listener;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:WeiboLoginInstance.java

示例11: login

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
@Override
public void login(PlatformActionListener platformActionListener) {
    mPlatformActionListener = platformActionListener;
    AccessTokenKeeper.clear(mContext);
    mAuthInfo = new AuthInfo(mContext, mSinaAppKey, mRedirectUrl, SCOPE);
    mSsoHandler = new SsoHandler((Activity) mContext, mAuthInfo);
    mSsoHandler.authorize(new AuthListener());

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:WeiboLoginManager.java

示例12: shareToWeibo

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
private void shareToWeibo() {
    mAccessToken = AccessTokenKeeper.readAccessToken(mContext);
    if (mAccessToken != null) {
        StatusesAPI statusAPI = new StatusesAPI(mContext, Constants.WEIBO_APPKEY, mAccessToken);
        statusAPI.update(shareText + mContext.getResources().getString(R.string.shareDescription) + shareLink, "0.0", "0.0", weiboListener);
        //statusAPI.uploadUrlText("分享一个音乐播放器,http://www.lingjutech.com", "http://tp3.sinaimg.cn/1706684510/50/22818070132/1", "", "0.0", "0.0", weiboListener);
    } else {
        AccessTokenKeeper.clear(mContext);
        Log.i(TAG, "Context=" + mContext);
        AuthInfo authInfo = new AuthInfo(mContext, Constants.WEIBO_APPKEY, Constants.REDIRECT_URL, Constants.SCOPE);
        //			WeiboAuth weiboAuth = new WeiboAuth(mContext, Constants.APP_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
        mSsoHandler = new SsoHandler((Activity) mContext, authInfo);
        mSsoHandler.authorize(new AuthListener());
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:16,代码来源:BaseDialog.java

示例13: onClick

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
@Override
public void onClick(View v) {
    if (v.getId() == R.id.signin_btn) {  // sign in
        AuthInfo authInfo = new AuthInfo(this, WeiboData.APP_KEY, WeiboData.REDIRECT_URL, WeiboData.SCOPE);
        ssoHandler = new SsoHandler(this, authInfo);
        ssoHandler.authorize(this);

    } else if (v.getId() == R.id.github_btn) {
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/sherlockchou86"));
        startActivity(browserIntent);
    }
}
 
开发者ID:sherlockchou86,项目名称:yphoto,代码行数:13,代码来源:SignInActivity.java

示例14: login

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
public static SsoHandler login(Activity context, String appName, String title, String content, String imgUrl, String playUrl, String from, int mode, String staticsId, String fragId) {
    if (isLogin(context) == 1 || isLogin2(context)) {
        SharePageEditActivity.launch((Context) context, 1, content, playUrl, "", mode, staticsId, fragId);
        if (context != null) {
            context.finish();
        }
        return null;
    }
    SsoHandler mSsoHandler = new SsoHandler(context, new AuthInfo(context, "3830215581", "http://m.letv.com", "email,direct_messages_read,direct_messages_write,friendships_groups_read,friendships_groups_write,statuses_to_me_read,follow_app_official_microblog,invitation_write"));
    mSsoHandler.authorize(new 5(context, content, playUrl, mode, staticsId, fragId));
    return mSsoHandler;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:13,代码来源:LetvSinaShareSSO.java

示例15: auth

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
@Override
public void auth(Activity activity) {
    ShareType = ShareConstant.AUTH;
    mAccessToken = new Oauth2AccessToken();
    mAuthInfo = new AuthInfo(activity, BuildConfig.SINA_APP_ID, REDIRECT_URL, null);
    mSsoHandler = new SsoHandler(activity, mAuthInfo);
    authWrap = new AuthWrap();

    authWrap.context = activity;
    authWrap.authListener = new AuthListener();
    mSsoHandler.authorize(authWrap.authListener);
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:13,代码来源:ShareSina.java


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