me.zhyd.oauth.model.AuthCallback Java Examples

The following examples show how to use me.zhyd.oauth.model.AuthCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AuthAlipayRequest.java    From JustAuth with MIT License 6 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest();
    request.setGrantType("authorization_code");
    request.setCode(authCallback.getAuth_code());
    AlipaySystemOauthTokenResponse response = null;
    try {
        response = this.alipayClient.execute(request);
    } catch (Exception e) {
        throw new AuthException(e);
    }
    if (!response.isSuccess()) {
        throw new AuthException(response.getSubMsg());
    }
    return AuthToken.builder()
        .accessToken(response.getAccessToken())
        .uid(response.getUserId())
        .expireIn(Integer.parseInt(response.getExpiresIn()))
        .refreshToken(response.getRefreshToken())
        .build();
}
 
Example #2
Source File: AuthElemeRequest.java    From JustAuth with MIT License 6 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    Map<String, String> form = new HashMap<>(4);
    form.put("client_id", config.getClientId());
    form.put("redirect_uri", config.getRedirectUri());
    form.put("code", authCallback.getCode());
    form.put("grant_type", "authorization_code");

    HttpHeader httpHeader = this.buildHeader(CONTENT_TYPE_FORM, this.getRequestId(), true);
    String response = new HttpUtils(config.getHttpConfig()).post(source.accessToken(), form, httpHeader, false);
    JSONObject object = JSONObject.parseObject(response);

    this.checkResponse(object);

    return AuthToken.builder()
        .accessToken(object.getString("access_token"))
        .refreshToken(object.getString("refresh_token"))
        .tokenType(object.getString("token_type"))
        .expireIn(object.getIntValue("expires_in"))
        .build();
}
 
Example #3
Source File: AuthFeishuRequest.java    From JustAuth with MIT License 6 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    JSONObject requestObject = new JSONObject();
    requestObject.put("app_id", config.getClientId());
    requestObject.put("app_secret", config.getClientSecret());
    requestObject.put("grant_type", "authorization_code");
    requestObject.put("code", authCallback.getCode());
    String response = new HttpUtils(config.getHttpConfig()).post(source.accessToken(), requestObject.toJSONString(), new HttpHeader()
        .add("Content-Type", "application/json"));
    JSONObject jsonObject = JSON.parseObject(response);
    this.checkResponse(jsonObject);
    return AuthToken.builder()
        .accessToken(jsonObject.getString("access_token"))
        .refreshToken(jsonObject.getString("refresh_token"))
        .expireIn(jsonObject.getIntValue("expires_in"))
        .tokenType(jsonObject.getString("token_type"))
        .openId(jsonObject.getString("open_id"))
        .build();

}
 
Example #4
Source File: AuthTeambitionRequest.java    From JustAuth with MIT License 6 votes vote down vote up
/**
 * @param authCallback 回调返回的参数
 * @return 所有信息
 */
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    Map<String, String> form = new HashMap<>(4);
    form.put("client_id", config.getClientId());
    form.put("client_secret", config.getClientSecret());
    form.put("code", authCallback.getCode());
    form.put("grant_type", "code");

    String response = new HttpUtils(config.getHttpConfig()).post(source.accessToken(), form, false);
    JSONObject accessTokenObject = JSONObject.parseObject(response);

    this.checkResponse(accessTokenObject);

    return AuthToken.builder()
        .accessToken(accessTokenObject.getString("access_token"))
        .refreshToken(accessTokenObject.getString("refresh_token"))
        .build();
}
 
Example #5
Source File: AuthMeituanRequest.java    From JustAuth with MIT License 6 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    Map<String, String> form = new HashMap<>(4);
    form.put("app_id", config.getClientId());
    form.put("secret", config.getClientSecret());
    form.put("code", authCallback.getCode());
    form.put("grant_type", "authorization_code");

    String response = new HttpUtils(config.getHttpConfig()).post(source.accessToken(), form, false);
    JSONObject object = JSONObject.parseObject(response);

    this.checkResponse(object);

    return AuthToken.builder()
        .accessToken(object.getString("access_token"))
        .refreshToken(object.getString("refresh_token"))
        .expireIn(object.getIntValue("expires_in"))
        .build();
}
 
Example #6
Source File: AuthStackOverflowRequest.java    From JustAuth with MIT License 6 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    String accessTokenUrl = accessTokenUrl(authCallback.getCode());
    Map<String, String> form = MapUtil.parseStringToMap(accessTokenUrl, false);
    HttpHeader httpHeader = new HttpHeader();
    httpHeader.add(Constants.CONTENT_TYPE, "application/x-www-form-urlencoded");
    String response = new HttpUtils(config.getHttpConfig()).post(accessTokenUrl, form, httpHeader, false);

    JSONObject accessTokenObject = JSONObject.parseObject(response);
    this.checkResponse(accessTokenObject);

    return AuthToken.builder()
        .accessToken(accessTokenObject.getString("access_token"))
        .expireIn(accessTokenObject.getIntValue("expires"))
        .build();
}
 
Example #7
Source File: AuthChecker.java    From JustAuth with MIT License 6 votes vote down vote up
/**
 * 校验回调传回的code
 * <p>
 * {@code v1.10.0}版本中改为传入{@code source}和{@code callback},对于不同平台使用不同参数接受code的情况统一做处理
 *
 * @param source   当前授权平台
 * @param callback 从第三方授权回调回来时传入的参数集合
 * @since 1.8.0
 */
public static void checkCode(AuthSource source, AuthCallback callback) {
    // 推特平台不支持回调 code 和 state
    if (source == AuthDefaultSource.TWITTER) {
        return;
    }
    String code = callback.getCode();
    if (source == AuthDefaultSource.ALIPAY) {
        code = callback.getAuth_code();
    } else if (source == AuthDefaultSource.HUAWEI) {
        code = callback.getAuthorization_code();
    }
    if (StringUtils.isEmpty(code)) {
        throw new AuthException(AuthResponseStatus.ILLEGAL_CODE, source);
    }
}
 
Example #8
Source File: AuthJdRequest.java    From JustAuth with MIT License 6 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {

    Map<String, String> params = new HashMap<>(5);
    params.put("app_key", config.getClientId());
    params.put("app_secret", config.getClientSecret());
    params.put("grant_type", "authorization_code");
    params.put("code", authCallback.getCode());
    String response = new HttpUtils(config.getHttpConfig()).post(source.accessToken(), params, false);
    JSONObject object = JSONObject.parseObject(response);

    this.checkResponse(object);

    return AuthToken.builder()
        .accessToken(object.getString("access_token"))
        .expireIn(object.getIntValue("expires_in"))
        .refreshToken(object.getString("refresh_token"))
        .scope(object.getString("scope"))
        .openId(object.getString("open_id"))
        .build();
}
 
Example #9
Source File: AuthExtendRequestTest.java    From JustAuth with MIT License 6 votes vote down vote up
@Test
public void login() {
    AuthRequest request = new AuthExtendRequest(AuthConfig.builder()
        .clientId("clientId")
        .clientSecret("clientSecret")
        .redirectUri("http://redirectUri")
        .build());

    String state = AuthStateUtils.createState();
    request.authorize(state);
    AuthCallback callback = AuthCallback.builder()
        .code("code")
        .state(state)
        .build();
    AuthResponse response = request.login(callback);
    Assert.assertNotNull(response);

    AuthUser user = (AuthUser) response.getData();
    Assert.assertNotNull(user);
    System.out.println(JSON.toJSONString(user));
}
 
Example #10
Source File: AuthServiceImpl.java    From OneBlog with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean login(String source, AuthCallback callback) {
    AuthRequest authRequest = RequestFactory.getInstance(source).getRequest();
    AuthResponse response = authRequest.login(callback);
    if (response.ok()) {
        AuthUser authUser = (AuthUser) response.getData();
        User newUser = BeanConvertUtil.doConvert(authUser, User.class);
        newUser.setSource(authUser.getSource().toString());
        if (null != authUser.getGender()) {
            newUser.setGender(authUser.getGender().getCode());
        }
        User user = userService.getByUuidAndSource(authUser.getUuid(), authUser.getSource().toString());
        newUser.setUserType(UserTypeEnum.USER);
        if (null != user) {
            newUser.setId(user.getId());
            userService.updateSelective(newUser);
        } else {
            userService.insert(newUser);
        }
        SessionUtil.setUser(newUser);
        return true;
    }
    log.warn("[{}] {}", source, response.getMsg());
    return false;
}
 
Example #11
Source File: SocialLoginServiceImpl.java    From FEBS-Cloud with Apache License 2.0 6 votes vote down vote up
@Override
public FebsResponse resolveLogin(String oauthType, AuthCallback callback) throws FebsException {
    FebsResponse febsResponse = new FebsResponse();
    AuthRequest authRequest = factory.get(getAuthSource(oauthType));
    AuthResponse<?> response = authRequest.login(resolveAuthCallback(callback));
    if (response.ok()) {
        AuthUser authUser = (AuthUser) response.getData();
        UserConnection userConnection = userConnectionService.selectByCondition(authUser.getSource().toString(), authUser.getUuid());
        if (userConnection == null) {
            febsResponse.message(NOT_BIND).data(authUser);
        } else {
            SystemUser user = userManager.findByName(userConnection.getUserName());
            if (user == null) {
                throw new FebsException("系统中未找到与第三方账号对应的账户");
            }
            OAuth2AccessToken oAuth2AccessToken = getOauth2AccessToken(user);
            febsResponse.message(SOCIAL_LOGIN_SUCCESS).data(oAuth2AccessToken);
            febsResponse.put(USERNAME, user.getUsername());
        }
    } else {
        throw new FebsException(String.format("第三方登录失败,%s", response.getMsg()));
    }
    return febsResponse;
}
 
Example #12
Source File: SocialLoginController.java    From FEBS-Cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 登录成功后的回调
 *
 * @param oauthType 第三方登录类型
 * @param callback  携带返回的信息
 * @return String
 */
@GetMapping("/{oauthType}/callback")
public String login(@PathVariable String oauthType, AuthCallback callback, String state, Model model) {
    try {
        FebsResponse febsResponse = null;
        String type = StringUtils.substringAfterLast(state, StringConstant.DOUBLE_COLON);
        if (StringUtils.equals(type, TYPE_BIND)) {
            febsResponse = socialLoginService.resolveBind(oauthType, callback);
        } else {
            febsResponse = socialLoginService.resolveLogin(oauthType, callback);
        }
        model.addAttribute("response", febsResponse);
        model.addAttribute("frontUrl", frontUrl);
        return "result";
    } catch (Exception e) {
        String errorMessage = FebsUtil.containChinese(e.getMessage()) ? e.getMessage() : "第三方登录失败";
        model.addAttribute("error", e.getMessage());
        return "fail";
    }
}
 
Example #13
Source File: AuthWeChatEnterpriseRequest.java    From JustAuth with MIT License 5 votes vote down vote up
/**
 * 微信的特殊性,此时返回的信息同时包含 openid 和 access_token
 *
 * @param authCallback 回调返回的参数
 * @return 所有信息
 */
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    String response = doGetAuthorizationCode(accessTokenUrl(authCallback.getCode()));

    JSONObject object = this.checkResponse(response);

    return AuthToken.builder()
        .accessToken(object.getString("access_token"))
        .expireIn(object.getIntValue("expires_in"))
        .code(authCallback.getCode())
        .build();
}
 
Example #14
Source File: AuthGitlabRequest.java    From JustAuth with MIT License 5 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    String response = doPostAuthorizationCode(authCallback.getCode());
    JSONObject object = JSONObject.parseObject(response);

    this.checkResponse(object);

    return AuthToken.builder()
        .accessToken(object.getString("access_token"))
        .refreshToken(object.getString("refresh_token"))
        .idToken(object.getString("id_token"))
        .tokenType(object.getString("token_type"))
        .scope(object.getString("scope"))
        .build();
}
 
Example #15
Source File: AuthGoogleRequest.java    From JustAuth with MIT License 5 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    String response = doPostAuthorizationCode(authCallback.getCode());
    JSONObject accessTokenObject = JSONObject.parseObject(response);
    this.checkResponse(accessTokenObject);
    return AuthToken.builder()
        .accessToken(accessTokenObject.getString("access_token"))
        .expireIn(accessTokenObject.getIntValue("expires_in"))
        .scope(accessTokenObject.getString("scope"))
        .tokenType(accessTokenObject.getString("token_type"))
        .idToken(accessTokenObject.getString("id_token"))
        .build();
}
 
Example #16
Source File: AuthHuaweiRequest.java    From JustAuth with MIT License 5 votes vote down vote up
/**
 * 获取access token
 *
 * @param authCallback 授权成功后的回调参数
 * @return token
 * @see AuthDefaultRequest#authorize()
 * @see AuthDefaultRequest#authorize(String)
 */
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    Map<String, String> form = new HashMap<>(5);
    form.put("grant_type", "authorization_code");
    form.put("code", authCallback.getAuthorization_code());
    form.put("client_id", config.getClientId());
    form.put("client_secret", config.getClientSecret());
    form.put("redirect_uri", config.getRedirectUri());

    String response = new HttpUtils(config.getHttpConfig()).post(source.accessToken(), form, false);
    return getAuthToken(response);
}
 
Example #17
Source File: AuthCodingRequest.java    From JustAuth with MIT License 5 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    String response = doGetAuthorizationCode(authCallback.getCode());
    JSONObject accessTokenObject = JSONObject.parseObject(response);
    this.checkResponse(accessTokenObject);
    return AuthToken.builder()
        .accessToken(accessTokenObject.getString("access_token"))
        .expireIn(accessTokenObject.getIntValue("expires_in"))
        .refreshToken(accessTokenObject.getString("refresh_token"))
        .build();
}
 
Example #18
Source File: AuthWeiboRequest.java    From JustAuth with MIT License 5 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    String response = doPostAuthorizationCode(authCallback.getCode());
    JSONObject accessTokenObject = JSONObject.parseObject(response);
    if (accessTokenObject.containsKey("error")) {
        throw new AuthException(accessTokenObject.getString("error_description"));
    }
    return AuthToken.builder()
        .accessToken(accessTokenObject.getString("access_token"))
        .uid(accessTokenObject.getString("uid"))
        .openId(accessTokenObject.getString("uid"))
        .expireIn(accessTokenObject.getIntValue("expires_in"))
        .build();
}
 
Example #19
Source File: AuthCsdnRequest.java    From JustAuth with MIT License 5 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    String response = doPostAuthorizationCode(authCallback.getCode());
    JSONObject accessTokenObject = JSONObject.parseObject(response);
    this.checkResponse(accessTokenObject);
    return AuthToken.builder().accessToken(accessTokenObject.getString("access_token")).build();
}
 
Example #20
Source File: AuthFacebookRequest.java    From JustAuth with MIT License 5 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    String response = doPostAuthorizationCode(authCallback.getCode());
    JSONObject accessTokenObject = JSONObject.parseObject(response);
    this.checkResponse(accessTokenObject);
    return AuthToken.builder()
        .accessToken(accessTokenObject.getString("access_token"))
        .expireIn(accessTokenObject.getIntValue("expires_in"))
        .tokenType(accessTokenObject.getString("token_type"))
        .build();
}
 
Example #21
Source File: AuthExtendRequest.java    From JustAuth with MIT License 5 votes vote down vote up
/**
 * 获取access token
 *
 * @param authCallback 授权成功后的回调参数
 * @return token
 * @see AuthDefaultRequest#authorize()
 * @see AuthDefaultRequest#authorize(String)
 */
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    return AuthToken.builder()
        .openId("openId")
        .expireIn(1000)
        .idToken("idToken")
        .scope("scope")
        .refreshToken("refreshToken")
        .accessToken("accessToken")
        .code("code")
        .build();
}
 
Example #22
Source File: GlobalAuthUtilsTest.java    From JustAuth with MIT License 5 votes vote down vote up
@Test
public void testGenerateTwitterSignatureForAccessToken() {
    AuthConfig config = AuthConfig.builder()
        .clientId("HD0XLqzi5Wz0G08rh45Cg8mgh")
        .clientSecret("0YX3RH2DnPiT77pgzLzFdfpMKX8ENLIWQKYQ7lG5TERuZNgXN5")
        .build();
    AuthCallback authCallback = AuthCallback.builder()
        .oauth_token("W_KLmAAAAAAAxq5LAAABbXxJeD0")
        .oauth_verifier("lYou4gxfA6S5KioUa8VF8HCShzA2nSxp")
        .build();
    Map<String, String> params = new HashMap<>();
    params.put("oauth_consumer_key", config.getClientId());
    params.put("oauth_nonce", "sTj7Ivg73u052eXstpoS1AWQCynuDEPN");
    params.put("oauth_signature_method", "HMAC-SHA1");
    params.put("oauth_timestamp", "1569751082");
    params.put("oauth_token", authCallback.getOauth_token());
    params.put("oauth_verifier", authCallback.getOauth_verifier());
    params.put("oauth_version", "1.0");

    params.put("oauth_signature", GlobalAuthUtils.generateTwitterSignature(params, "POST", TWITTER.accessToken(), config.getClientSecret(), authCallback
        .getOauth_token()));

    params.forEach((k, v) -> params.put(k, "\"" + GlobalAuthUtils.urlEncode(v) + "\""));
    String actual = "OAuth " + GlobalAuthUtils.parseMapToString(params, false).replaceAll("&", ", ");

    assertEquals("OAuth oauth_verifier=\"lYou4gxfA6S5KioUa8VF8HCShzA2nSxp\", oauth_nonce=\"sTj7Ivg73u052eXstpoS1AWQCynuDEPN\", oauth_signature=\"9i0lmWgvphtkl2KcCO9VyZ3K2%2F0%3D\", oauth_token=\"W_KLmAAAAAAAxq5LAAABbXxJeD0\", oauth_consumer_key=\"HD0XLqzi5Wz0G08rh45Cg8mgh\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1569751082\", oauth_version=\"1.0\"", actual);
}
 
Example #23
Source File: OAuthController.java    From OneBlog with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 授权回调地址
 *
 * @param source   授权回调来源
 * @param callback 回调参数包装类
 * @return
 */
@RequestMapping("/callback/{source}")
public ModelAndView login(@PathVariable("source") String source, AuthCallback callback, HttpSession session) {
    authService.login(source, callback);
    String historyUrl = (String) session.getAttribute("historyUrl");
    session.removeAttribute("historyUrl");
    if (StringUtils.isEmpty(historyUrl)) {
        return ResultUtil.redirect("/");
    }
    return ResultUtil.redirect(historyUrl);
}
 
Example #24
Source File: OauthController.java    From spring-boot-demo with MIT License 5 votes vote down vote up
/**
 * 登录成功后的回调
 *
 * @param oauthType 第三方登录类型
 * @param callback  携带返回的信息
 * @return 登录成功后的信息
 */
@RequestMapping("/{oauthType}/callback")
public AuthResponse login(@PathVariable String oauthType, AuthCallback callback) {
    AuthRequest authRequest = factory.get(getAuthSource(oauthType));
    AuthResponse response = authRequest.login(callback);
    log.info("【response】= {}", JSONUtil.toJsonStr(response));
    return response;
}
 
Example #25
Source File: OauthController.java    From cms with Apache License 2.0 5 votes vote down vote up
@RequestMapping("/{type}/callback")
public void login(@PathVariable String type, String redirect, AuthCallback callback, HttpServletResponse response) throws IOException {
    AuthRequest authRequest = factory.get(type);
    AuthResponse authResponse = authRequest.login(callback);
    log.info("【response】= {}", JSONUtil.toJsonStr(authResponse));
    response.sendRedirect(redirect);
}
 
Example #26
Source File: AuthGiteeRequest.java    From JustAuth with MIT License 5 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    String response = doPostAuthorizationCode(authCallback.getCode());
    JSONObject accessTokenObject = JSONObject.parseObject(response);
    this.checkResponse(accessTokenObject);
    return AuthToken.builder()
        .accessToken(accessTokenObject.getString("access_token"))
        .refreshToken(accessTokenObject.getString("refresh_token"))
        .scope(accessTokenObject.getString("scope"))
        .tokenType(accessTokenObject.getString("token_type"))
        .expireIn(accessTokenObject.getIntValue("expires_in"))
        .build();
}
 
Example #27
Source File: AuthDefaultRequest.java    From JustAuth with MIT License 5 votes vote down vote up
/**
 * 统一的登录入口。当通过{@link AuthDefaultRequest#authorize(String)}授权成功后,会跳转到调用方的相关回调方法中
 * 方法的入参可以使用{@code AuthCallback},{@code AuthCallback}类中封装好了OAuth2授权回调所需要的参数
 *
 * @param authCallback 用于接收回调参数的实体
 * @return AuthResponse
 */
@Override
public AuthResponse login(AuthCallback authCallback) {
    try {
        AuthChecker.checkCode(source, authCallback);
        AuthChecker.checkState(authCallback.getState(), source, authStateCache);

        AuthToken authToken = this.getAccessToken(authCallback);
        AuthUser user = this.getUserInfo(authToken);
        return AuthResponse.builder().code(AuthResponseStatus.SUCCESS.getCode()).data(user).build();
    } catch (Exception e) {
        Log.error("Failed to login with oauth authorization.", e);
        return this.responseError(e);
    }
}
 
Example #28
Source File: SocialLoginServiceImpl.java    From FEBS-Cloud with Apache License 2.0 5 votes vote down vote up
@Override
public FebsResponse resolveBind(String oauthType, AuthCallback callback) throws FebsException {
    FebsResponse febsResponse = new FebsResponse();
    AuthRequest authRequest = factory.get(getAuthSource(oauthType));
    AuthResponse<?> response = authRequest.login(resolveAuthCallback(callback));
    if (response.ok()) {
        febsResponse.data(response.getData());
    } else {
        throw new FebsException(String.format("第三方登录失败,%s", response.getMsg()));
    }
    return febsResponse;
}
 
Example #29
Source File: AuthOschinaRequest.java    From JustAuth with MIT License 5 votes vote down vote up
@Override
protected AuthToken getAccessToken(AuthCallback authCallback) {
    String response = doPostAuthorizationCode(authCallback.getCode());
    JSONObject accessTokenObject = JSONObject.parseObject(response);
    this.checkResponse(accessTokenObject);
    return AuthToken.builder()
        .accessToken(accessTokenObject.getString("access_token"))
        .refreshToken(accessTokenObject.getString("refresh_token"))
        .uid(accessTokenObject.getString("uid"))
        .expireIn(accessTokenObject.getIntValue("expires_in"))
        .build();
}
 
Example #30
Source File: SocialLoginServiceImpl.java    From FEBS-Cloud with Apache License 2.0 5 votes vote down vote up
private AuthCallback resolveAuthCallback(AuthCallback callback) {
    int stateLength = 3;
    String state = callback.getState();
    String[] strings = StringUtils.splitByWholeSeparatorPreserveAllTokens(state, StringConstant.DOUBLE_COLON);
    if (strings.length == stateLength) {
        callback.setState(strings[0] + StringConstant.DOUBLE_COLON + strings[1]);
    }
    return callback;
}