Blame view

Pods/Realm/include/RLMCredentials.h 4.02 KB
75d24c15   yangbin   123
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
  ////////////////////////////////////////////////////////////////////////////
  //
  // Copyright 2020 Realm Inc.
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  // http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  //
  ////////////////////////////////////////////////////////////////////////////
  
  #import <Realm/RLMSyncUtil.h>
  
  NS_ASSUME_NONNULL_BEGIN
  @protocol RLMBSON;
  
  /// A token representing an identity provider's credentials.
  typedef NSString *RLMCredentialsToken;
  
  /// A type representing the unique identifier of a MongoDB Realm identity provider.
  typedef NSString *RLMIdentityProvider NS_EXTENSIBLE_STRING_ENUM;
  
  /// The username/password identity provider. User accounts are handled by MongoDB Realm directly without the
  /// involvement of a third-party identity provider.
  extern RLMIdentityProvider const RLMIdentityProviderUsernamePassword;
  
  /// A Facebook account as an identity provider.
  extern RLMIdentityProvider const RLMIdentityProviderFacebook;
  
  /// A Google account as an identity provider.
  extern RLMIdentityProvider const RLMIdentityProviderGoogle;
  
  /// An Apple account as an identity provider.
  extern RLMIdentityProvider const RLMIdentityProviderApple;
  
  /// A JSON Web Token as an identity provider.
  extern RLMIdentityProvider const RLMIdentityProviderJWT;
  
  /// An Anonymous account as an identity provider.
  extern RLMIdentityProvider const RLMIdentityProviderAnonymous;
  
  /// An Realm Cloud function as an identity provider.
  extern RLMIdentityProvider const RLMIdentityProviderFunction;
  
  /// A user api key as an identity provider.
  extern RLMIdentityProvider const RLMIdentityProviderUserAPIKey;
  
  /// A server api key as an identity provider.
  extern RLMIdentityProvider const RLMIdentityProviderServerAPIKey;
  
  /**
   Opaque credentials representing a specific Realm App user.
   */
  @interface RLMCredentials : NSObject
  
  /// The name of the identity provider which generated the credentials token.
  @property (nonatomic) RLMIdentityProvider provider;
  
  /**
   Construct and return credentials from a Facebook account token.
   */
  + (instancetype)credentialsWithFacebookToken:(RLMCredentialsToken)token;
  
  /**
   Construct and return credentials from a Google account token.
   */
  + (instancetype)credentialsWithGoogleAuthCode:(RLMCredentialsToken)token;
  
  /**
   Construct and return credentials from a Google id token.
   */
  + (instancetype)credentialsWithGoogleIdToken:(RLMCredentialsToken)token;
  
  /**
   Construct and return credentials from an Apple account token.
   */
  + (instancetype)credentialsWithAppleToken:(RLMCredentialsToken)token;
  
  /**
   Construct and return credentials for a MongoDB Realm function using a mongodb document as a json payload.
  */
  + (instancetype)credentialsWithFunctionPayload:(NSDictionary<NSString *, id<RLMBSON>> *)payload;
  
  /**
   Construct and return credentials from a user api key.
  */
  + (instancetype)credentialsWithUserAPIKey:(NSString *)apiKey;
  
  /**
   Construct and return credentials from a server api key.
  */
  + (instancetype)credentialsWithServerAPIKey:(NSString *)apiKey;
  
  /**
   Construct and return MongoDB Realm credentials from an email and password.
   */
  + (instancetype)credentialsWithEmail:(NSString *)email
                              password:(NSString *)password;
  
  /**
   Construct and return credentials from a JSON Web Token.
   */
  + (instancetype)credentialsWithJWT:(NSString *)token;
  
  /**
   Construct and return anonymous credentials
   */
  + (instancetype)anonymousCredentials;
  
  /// :nodoc:
  - (instancetype)init __attribute__((unavailable("RLMAppCredentials cannot be created directly")));
  
  /// :nodoc:
  + (instancetype)new __attribute__((unavailable("RLMAppCredentials cannot be created directly")));
  
  NS_ASSUME_NONNULL_END
  
  @end