org.frameworkset.web.auth.AppAuthenticate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bboss-ticket Show documentation
Show all versions of bboss-ticket Show documentation
support session share between application cluster nodes and cross domain application nodes.support good application session monitor and session data statitic module.demo site http://session.bbossgroups.com/
The newest version!
/**
*
*/
package org.frameworkset.web.auth;
import java.util.Map;
import org.frameworkset.web.token.TokenHelper;
import org.frameworkset.web.token.ws.v2.AuthorService;
/**
* 应用后端登陆系统
* @author yinbp
*
* @Date:2016-11-18 17:56:43
*/
public class AppAuthenticate {
/**
*
*/
public AppAuthenticate() {
// TODO Auto-generated constructor stub
}
protected String sessionid = null;
protected String account;
protected String password;
protected Map extendAttributes;
protected AuthenticatedToken token;
protected String authenticatecode;
/**
*
*/
public AppAuthenticate(String sessionid , String account,String password,Map extendAttributes) {
this.account = account;
this.password = password;
this.extendAttributes = extendAttributes;
this.sessionid = sessionid;
}
protected void afterSuccessLogin()
{
}
public AuthenticatedToken login() throws AuthenticateException
{
AuthorService authorService = TokenHelper.getTokenService().getAuthorService();
//构建一个待验证的token
String authtoken = null;
authtoken = AuthorHelper.encodeAuthenticateRequest(sessionid,account,password, extendAttributes);
AuthenticateResponse authorResponse = authorService.auth(authtoken);
if(authorResponse.isValidateResult())
{
try {
authenticatecode = authorResponse.getAuthorization();
token = AuthorHelper.decodeMessageResponse(authorResponse.getAuthorization());
afterSuccessLogin();
return token;
} catch (AuthenticateException e) {
throw e;
}
}
else
{
throw new AuthenticateException(authorResponse.getError());
}
}
public AuthenticateResponse ssologin() throws AuthenticateException
{
AuthorService authorService = TokenHelper.getTokenService().getAuthorService();
//构建一个待验证的token
AuthorHelper authorHelper = TokenHelper.getTokenService().getAuthorHelper();
String authtoken = AuthorHelper.encodeAuthenticateRequest(sessionid,account,password, extendAttributes);
AuthenticateResponse authorResponse = authorService.auth(authtoken);
return authorResponse;
}
public String getAuthenticatecode() {
return authenticatecode;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy