예제 #1
0
  @Override
  public void init(Context context) {
    String userInfoProperty = settings.getString(USER_INFO);
    if (userInfoProperty == null) {
      throw new IllegalStateException(String.format("The property %s is required", USER_INFO));
    }
    String[] userInfos = userInfoProperty.split(",");
    context.authenticate(
        UserIdentity.builder()
            .setLogin(userInfos[0])
            .setProviderLogin(userInfos[1])
            .setName(userInfos[2])
            .setEmail(userInfos[3])
            .build());

    try {
      context.getResponse().sendRedirect("/");
    } catch (IOException e) {
      throw new IllegalStateException("Fail to redirect to home", e);
    }
  }