Examples of LoginInfo


Examples of com.atlassian.jira.rest.client.api.domain.LoginInfo

  public LoginInfo parse(JSONObject json) throws JSONException {
    final int failedLoginCount = json.optInt("failedLoginCount");
    final int loginCount = json.getInt("loginCount");
    final DateTime lastFailedLoginTime = JsonParseUtil.parseOptionalDateTime(json, "lastFailedLoginTime");
    final DateTime previousLoginTime = JsonParseUtil.parseOptionalDateTime(json, "previousLoginTime");
    return new LoginInfo(failedLoginCount, loginCount, lastFailedLoginTime, previousLoginTime);
  }
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.LoginInfo

    public LoginInfo parse(JSONObject json) throws JSONException {
        final int failedLoginCount = json.optInt("failedLoginCount");
        final int loginCount = json.getInt("loginCount");
        final DateTime lastFailedLoginTime = JsonParseUtil.parseOptionalDateTime(json, "lastFailedLoginTime");
        final DateTime previousLoginTime = JsonParseUtil.parseOptionalDateTime(json, "previousLoginTime");
        return new LoginInfo(failedLoginCount, loginCount, lastFailedLoginTime, previousLoginTime);
    }
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.LoginInfo

    private final SessionCookieJsonParser sessionCookieJsonParser = new SessionCookieJsonParser();
    private final LoginInfoJsonParser loginInfoJsonParser = new LoginInfoJsonParser();
    @Override
    public Authentication parse(JSONObject json) throws JSONException {
        final SessionCookie sessionCookie = sessionCookieJsonParser.parse(json.getJSONObject("session"));
        final LoginInfo loginInfo = loginInfoJsonParser.parse(json.getJSONObject("loginInfo"));
        return new Authentication(loginInfo, sessionCookie);
    }
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.LoginInfo

  private final LoginInfoJsonParser loginInfoJsonParser = new LoginInfoJsonParser();
  @Override
  public Session parse(JSONObject json) throws JSONException {
    final URI userUri = JsonParseUtil.getSelfUri(json);
    final String username = json.getString("name");
    final LoginInfo loginInfo = loginInfoJsonParser.parse(json.getJSONObject("loginInfo"));
    return new Session(userUri, username, loginInfo);
  }
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.LoginInfo

public class LoginInfoJsonParserTest {
    @Test
    public void testParse() throws Exception {
        final LoginInfoJsonParser parser = new LoginInfoJsonParser();
        final LoginInfo loginInfo = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/loginInfo/valid.json"));
        assertEquals(new LoginInfo(5, 379, TestUtil.toDateTime("2010-09-13T17:19:20.752+0200"),
                TestUtil.toDateTime("2010-09-13T17:19:38.220+0200")), loginInfo);
    }
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.LoginInfo

    }

  @Test
  public void testParseNoFailedLoginBefore() throws Exception {
    final LoginInfoJsonParser parser = new LoginInfoJsonParser();
    final LoginInfo loginInfo = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/loginInfo/valid-no-login-failure.json"));
    assertEquals(new LoginInfo(0, 379, null, TestUtil.toDateTime("2010-09-13T17:19:38.220+0200")), loginInfo);
  }
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.LoginInfo

  }

  @Test
  public void testParseNoLoginBefore() throws Exception {
    final LoginInfoJsonParser parser = new LoginInfoJsonParser();
    final LoginInfo loginInfo = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/loginInfo/valid-no-login-so-far.json"));
    assertEquals(new LoginInfo(0, 1, null, null), loginInfo);
  }
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.LoginInfo

  public void testParse() throws Exception {
    SessionJsonParser parser = new SessionJsonParser();
    final Session session = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/session/valid.json"));
    assertEquals(TestConstants.USER_ADMIN.getSelf(), session.getUserUri());
    assertEquals("admin", session.getUsername());
    assertEquals(new LoginInfo(12, 413, TestUtil.toDateTime("2010-09-14T16:15:47.554+0200"),
        TestUtil.toDateTime("2010-09-14T16:48:33.002+0200")), session.getLoginInfo());
  }
View Full Code Here

Examples of com.atlassian.jira.rest.client.domain.LoginInfo

public class AuthenticationJsonParserTest {
    @Test
    public void testParse() throws Exception {
        final AuthenticationJsonParser parser = new AuthenticationJsonParser();
        final Authentication authentication = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/authentication/valid.json"));
        assertEquals(new Authentication(new LoginInfo(54, 23, toDateTime("2010-09-13T17:19:20.752+0300"),
                toDateTime("2010-09-13T17:19:38.220+0900")), new SessionCookie("JSESSIONID", "E5BD072ABEE0082DE4D6C8C2B6D96B79")), authentication);
    }
View Full Code Here

Examples of com.google.gwt.maeglin89273.game.mengine.service.LoginInfo

   */
  @Override
  public CheckLoginResponse checkLogin(CheckLoginRequest request) {
    UserService svc=getUserService();
    User user=svc.getCurrentUser();
    LoginInfo loginInfo;
    CheckLoginResponse response;
   
    if(user!=null){
      loginInfo=new LoginInfo(LoginInfo.Status.LOGGED_IN,svc.createLogoutURL(request.getRquestUrl()),new GoogleAccount(user.getEmail(),user.getNickname()));
      DatastoreService datastore=getDatastoreService();
      TransportablePlayer localPlayer=request.getLocalPlayer();
      Key key=KeyFactory.createKey(Player.class.getSimpleName(), user.getEmail());
      String keyString=KeyFactory.keyToString(key);
     
      try{
        Entity player=datastore.get(key);
       
        if(localPlayer.getID().equals(player.getProperty(TransportablePlayer.ID_PROPERTY))){
          //the achievement has changed
          if(!player.getProperty(TransportablePlayer.ACHIEVEMENT_PROPERTY).equals(localPlayer.getEncryptedAchievements())){
            //if the date is greater than client timestamp, do download. Else, do upload
            if(localPlayer.getTimestamp()!=null&&((Date)player.getProperty(TransportablePlayer.DATE_PROPERTY)).compareTo(localPlayer.getTimestamp())>0){
              //do download
              response=doDownload(player,loginInfo,keyString);
            }else{
              //do upload
              response=doUpload(datastore, player, loginInfo, keyString, localPlayer);
            }
          }else{
            //local player patch
            if(localPlayer.getTimestamp()==null){
              localPlayer.setTimestamp((Date)player.getProperty(TransportablePlayer.DATE_PROPERTY));
            }
            localPlayer.setKey(keyString);
            response=new CheckLoginResponse(Status.UPLOAD,loginInfo,localPlayer);
          }
        }else{
          //do download
          response=doDownload(player,loginInfo,keyString);
        }
      }catch(EntityNotFoundException e){
        //request to create a new player
        response=requestNewPlayer(keyString, loginInfo, localPlayer);
      }
     
    }else{
      loginInfo=new LoginInfo(LoginInfo.Status.LOGGED_OUT, svc.createLoginURL(request.getRquestUrl()));
      response=new CheckLoginResponse(Status.NOT_LOGGED_IN,loginInfo,null);
    }
    return response;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.