Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14792 manas 1
/**
2
 * Copyright 2010-present Facebook.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *    http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
 
17
package com.facebook;
18
 
19
/**
20
 * Specifies the behaviors to try during
21
 * {@link Session#openForRead(com.facebook.Session.OpenRequest) openForRead},
22
 * {@link Session#openForPublish(com.facebook.Session.OpenRequest) openForPublish},
23
 * {@link Session#requestNewReadPermissions(com.facebook.Session.NewPermissionsRequest) requestNewReadPermissions}, or
24
 * {@link Session#requestNewPublishPermissions(com.facebook.Session.NewPermissionsRequest) requestNewPublishPermissions}.
25
 */
26
public enum SessionLoginBehavior {
27
    /**
28
     * Specifies that Session should attempt Single Sign On (SSO), and if that
29
     * does not work fall back to dialog auth. This is the default behavior.
30
     */
31
    SSO_WITH_FALLBACK(true, true),
32
 
33
    /**
34
     * Specifies that Session should only attempt SSO. If SSO fails, then the
35
     * open or new permissions call fails.
36
     */
37
    SSO_ONLY(true, false),
38
 
39
    /**
40
     * Specifies that SSO should not be attempted, and to only use dialog auth.
41
     */
42
    SUPPRESS_SSO(false, true);
43
 
44
    private final boolean allowsKatanaAuth;
45
    private final boolean allowsWebViewAuth;
46
 
47
    private SessionLoginBehavior(boolean allowsKatanaAuth, boolean allowsWebViewAuth) {
48
        this.allowsKatanaAuth = allowsKatanaAuth;
49
        this.allowsWebViewAuth = allowsWebViewAuth;
50
    }
51
 
52
    boolean allowsKatanaAuth() {
53
        return allowsKatanaAuth;
54
    }
55
 
56
    boolean allowsWebViewAuth() {
57
        return allowsWebViewAuth;
58
    }
59
}