RMS SDK for C++  0.2.1
A client library for using Microsoft RMS from Linux.
OAuthConstants.h
1 /*
2  * ======================================================================
3  * Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
4  * Licensed under the MIT License.
5  * See LICENSE.md in the project root for license information.
6  * ======================================================================
7 */
8 
9 #ifndef OAUTHCONSTANTS_H
10 #define OAUTHCONSTANTS_H
11 
12 #include "types.h"
13 
14 namespace rmsauth {
15 
17 {
18  struct OAuthParameter {
19  const String ResponseType = "response_type";
20  const String GrantType = "grant_type";
21  const String ClientId = "client_id";
22  const String ClientSecret = "client_secret";
23  const String ClientAssertion = "client_assertion";
24  const String ClientAssertionType = "client_assertion_type";
25  const String RefreshToken = "refresh_token";
26  const String RedirectUri = "redirect_uri";
27  const String Resource = "resource";
28  const String Code = "code";
29  const String Scope = "scope";
30  const String Assertion = "assertion";
31  const String RequestedTokenUse = "requested_token_use";
32  const String Username = "username";
33  const String Password = "password";
34  const String FormsAuth = "amr_values";
35  const String LoginHint = "login_hint"; // login_hint is not standard oauth2 parameter
36  const String CorrelationId = "client-request-id"; // correlation id is not standard oauth2 parameter
37  const String Prompt = "prompt"; // prompt is not standard oauth2 parameter
38  };
39 
40  static const OAuthParameter& oAuthParameter()
41  {
42  static const OAuthParameter oAuthParameter{};
43  return oAuthParameter;
44  }
45 
46  struct OAuthGrantType {
47  const String AuthorizationCode = "authorization_code";
48  const String RefreshToken = "refresh_token";
49  const String ClientCredentials = "client_credentials";
50  const String Saml11Bearer = "urn:ietf:params:oauth:grant-type:saml1_1-bearer";
51  const String Saml20Bearer = "urn:ietf:params:oauth:grant-type:saml2-bearer";
52  const String JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer";
53  const String Password = "password";
54  };
55 
56  static const OAuthGrantType& oAuthGrantType()
57  {
58  static const OAuthGrantType oAuthGrantType{};
59  return oAuthGrantType;
60  }
61 
63  {
64  const String Code = "code";
65 
66  };
67 
68  static const OAuthResponseType& oAuthResponseType()
69  {
70  static const OAuthResponseType oAuthResponseType{};
71  return oAuthResponseType;
72  }
73 
75  const String Code = "code";
76  const String TokenType = "token_type";
77  const String AccessToken = "access_token";
78  const String RefreshToken = "refresh_token";
79  const String Resource = "resource";
80  const String IdToken = "id_token";
81  const String CreatedOn = "created_on";
82  const String ExpiresOn = "expires_on";
83  const String ExpiresIn = "expires_in";
84  const String Error = "error";
85  const String ErrorDescription = "error_description";
86  const String ErrorCodes = "error_codes";
87  };
88 
89  static const OAuthReservedClaim& oAuthReservedClaim()
90  {
91  static const OAuthReservedClaim oAuthReservedClaim{};
92  return oAuthReservedClaim;
93  }
94 
95 
96  struct IdTokenClaim {
97  const String ObjectId = "oid";
98  const String Subject = "sub";
99  const String TenantId = "tid";
100  const String UPN = "upn";
101  const String Email = "email";
102  const String GivenName = "given_name";
103  const String FamilyName = "family_name";
104  const String IdentityProvider = "idp";
105  const String Issuer = "iss";
106  const String PasswordExpiration = "pwd_exp";
107  const String PasswordChangeUrl = "pwd_url";
108  };
109 
110  static const IdTokenClaim& idTokenClaim()
111  {
112  static const IdTokenClaim idTokenClaim{};
113  return idTokenClaim;
114  }
115 
116 
118  const String JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer";
119  };
120 
121  static const OAuthAssertionType& oAuthAssertionType()
122  {
123  static const OAuthAssertionType oAuthAssertionType{};
124  return oAuthAssertionType;
125  }
126 
127 
129  const String OnBehalfOf = "on_behalf_of";
130  };
131 
132  static const OAuthRequestedTokenUse& oAuthRequestedTokenUse()
133  {
134  static const OAuthRequestedTokenUse oAuthRequestedTokenUse{};
135  return oAuthRequestedTokenUse;
136  }
137 
138 
139  struct OAuthHeader {
140  const String CorrelationId = "client-request-id";
141  const String RequestCorrelationIdInResponse = "return-client-request-id";
142  };
143 
144  static const OAuthHeader& oAuthHeader()
145  {
146  static const OAuthHeader oAuthHeader{};
147  return oAuthHeader;
148  }
149 
150 
151  struct OAuthError {
152  const String LoginRequired = "login_required";
153  const String InvalidGrant = "invalid_grant";
154  } ;
155 
156  static const OAuthError& oAuthError()
157  {
158  static const OAuthError oAuthError{};
159  return oAuthError;
160  }
161 
162 
163  struct OAuthValue {
164  const String FormsAuth = "pwd";
165  const String ScopeOpenId = "openid";
166  };
167 
168  static const OAuthValue& oAuthValue()
169  {
170  static const OAuthValue oAuthValue{};
171  return oAuthValue;
172  }
173 
174 
175  struct PromptValue {
176  const String Login = "login";
177  const String RefreshSession = "refresh_session";
178 
179  // The behavior of this value is identical to prompt=none for managed users; However, for federated users, AAD
180  // redirects to ADFS as it cannot determine in advance whether ADFS can login user silently (e.g. via WIA) or not.
181  const String AttemptNone = "attempt_none";
182  };
183 
184  static const PromptValue& promptValue()
185  {
186  static const PromptValue promptValue{};
187  return promptValue;
188  }
189 };
190 
191 } // namespace rmsauth {
192 
193 #endif // OAUTHCONSTANTS_H
Definition: OAuthConstants.h:46
Definition: ClientAssertion.h:16
Definition: OAuthConstants.h:62
Definition: OAuthConstants.h:74
Definition: OAuthConstants.h:16
Definition: OAuthConstants.h:18
Definition: Entities.h:58
Definition: OAuthConstants.h:151
Definition: OAuthConstants.h:139
Definition: OAuthConstants.h:128
Definition: OAuthConstants.h:163
Definition: OAuthConstants.h:175
Definition: AcquireTokenForClientHandler.h:14
Definition: OAuthConstants.h:117
Definition: OAuthConstants.h:96