/** * Sets the callback interface that will be called whenever the status of the Session associated * with this LoginButton changes. * * @return the callback interface */ public Session.StatusCallback getSessionStatusCallback() { return properties.getSessionStatusCallback(); }
// For testing purposes only List<String> getPermissions() { return properties.getPermissions(); }
/** * Gets the login behavior for the session that will be opened. If null is returned, the default * ({@link SessionLoginBehavior SessionLoginBehavior.SSO_WITH_FALLBACK} will be used. * * @return loginBehavior The {@link SessionLoginBehavior SessionLoginBehavior} that specifies what * behaviors should be attempted during authorization. */ public SessionLoginBehavior getLoginBehavior() { return properties.getLoginBehavior(); }
/** * Sets the callback interface that will be called whenever the status of the Session associated * with this LoginButton changes. Note that updates will only be sent to the callback while the * LoginButton is actually attached to a window. * * @param callback the callback interface */ public void setSessionStatusCallback(Session.StatusCallback callback) { properties.setSessionStatusCallback(callback); }
/** Clears the permissions currently associated with this LoginButton. */ public void clearPermissions() { properties.clearPermissions(); }
/** * Sets the login behavior for the session that will be opened. If null is specified, the default * ({@link SessionLoginBehavior SessionLoginBehavior.SSO_WITH_FALLBACK} will be used. * * @param loginBehavior The {@link SessionLoginBehavior SessionLoginBehavior} that specifies what * behaviors should be attempted during authorization. */ public void setLoginBehavior(SessionLoginBehavior loginBehavior) { properties.setLoginBehavior(loginBehavior); }
/** * Gets the default audience to use when the session is opened. This value is only useful when * specifying write permissions for the native login dialog. * * @return the default audience value to use */ public SessionDefaultAudience getDefaultAudience() { return properties.getDefaultAudience(); }
/** * Set the permissions to use when the session is opened. The permissions here should only be * publish permissions. If any read permissions are included, the login attempt by the user may * fail. The LoginButton can only be associated with either read permissions or publish * permissions, but not both. Calling both setReadPermissions and setPublishPermissions on the * same instance of LoginButton will result in an exception being thrown unless clearPermissions * is called in between. * * <p>This method is only meaningful if called before the session is open. If this is called after * the session is opened, and the list of permissions passed in is not a subset of the permissions * granted during the authorization, it will log an error. * * <p>Since the session can be automatically opened when the LoginButton is constructed, it's * important to always pass in a consistent set of permissions to this method, or manage the * setting of permissions outside of the LoginButton class altogether (by managing the session * explicitly). * * @param permissions the read permissions to use * @throws UnsupportedOperationException if setReadPermissions has been called * @throws IllegalArgumentException if permissions is null or empty */ public void setPublishPermissions(List<String> permissions) { properties.setPublishPermissions(permissions, sessionTracker.getSession()); }
/** * Sets the default audience to use when the session is opened. This value is only useful when * specifying write permissions for the native login dialog. * * @param defaultAudience the default audience value to use */ public void setDefaultAudience(SessionDefaultAudience defaultAudience) { properties.setDefaultAudience(defaultAudience); }
/** * Returns the current OnErrorListener for this instance of LoginButton. * * @return The OnErrorListener */ public OnErrorListener getOnErrorListener() { return properties.getOnErrorListener(); }
/** * Sets an OnErrorListener for this instance of LoginButton to call into when certain exceptions * occur. * * @param onErrorListener The listener object to set */ public void setOnErrorListener(OnErrorListener onErrorListener) { properties.setOnErrorListener(onErrorListener); }
/** * Set the permissions to use when the user logs in. The permissions here should only be publish * permissions. If any read permissions are included, the login attempt by the user may fail. The * LoginButton can only be associated with either read permissions or publish permissions, but not * both. Calling both setReadPermissions and setPublishPermissions on the same instance of * LoginButton will result in an exception being thrown unless clearPermissions is called in * between. * * <p>This method is only meaningful if called before the user logs in. If this is called after * login, and the list of permissions passed in is not a subset of the permissions granted during * the authorization, it will log an error. * * <p>It's important to always pass in a consistent set of permissions to this method, or manage * the setting of permissions outside of the LoginButton class altogether (by using the * LoginManager explicitly). * * @param permissions the publish permissions to use * @throws UnsupportedOperationException if setReadPermissions has been called * @throws IllegalArgumentException if permissions is null or empty */ public void setPublishPermissions(String... permissions) { properties.setPublishPermissions(Arrays.asList(permissions)); }
/** * Set the permissions to use when the user logs in. The permissions here should only be publish * permissions. If any read permissions are included, the login attempt by the user may fail. The * LoginButton can only be associated with either read permissions or publish permissions, but not * both. Calling both setReadPermissions and setPublishPermissions on the same instance of * LoginButton will result in an exception being thrown unless clearPermissions is called in * between. * * <p>This method is only meaningful if called before the user logs in. If this is called after * login, and the list of permissions passed in is not a subset of the permissions granted during * the authorization, it will log an error. * * <p>It's important to always pass in a consistent set of permissions to this method, or manage * the setting of permissions outside of the LoginButton class altogether (by using the * LoginManager explicitly). * * @param permissions the publish permissions to use * @throws UnsupportedOperationException if setReadPermissions has been called * @throws IllegalArgumentException if permissions is null or empty */ public void setPublishPermissions(List<String> permissions) { properties.setPublishPermissions(permissions); }