本文整理汇总了C#中TokenId类的典型用法代码示例。如果您正苦于以下问题:C# TokenId类的具体用法?C# TokenId怎么用?C# TokenId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TokenId类属于命名空间,在下文中一共展示了TokenId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Token
public Token(TokenId tokenId, string data, Location startLocation, Location endLocation)
{
_tokenId = tokenId;
_data = data;
_startLocation = startLocation;
_endLocation = endLocation;
}
开发者ID:yslib,项目名称:minimvc,代码行数:7,代码来源:Token.cs
示例2: BinaryExpression
public BinaryExpression(TokenId op, ExpressionNode left, ExpressionNode right)
: base(left.RelatedToken)
{
_op = op;
_left = left;
_right = right;
}
开发者ID:yslib,项目名称:minimvc,代码行数:7,代码来源:BinaryExpression.cs
示例3: Token
public Token(string text, TokenId tokenId, int pos, SourceRange range)
{
_text = text;
_tokenId = tokenId;
_pos = pos;
_range = range;
}
开发者ID:chenzuo,项目名称:nquery,代码行数:7,代码来源:Token.cs
示例4: MemberAccessExpression
public MemberAccessExpression(ExpressionNode left, ExpressionNode right, TokenId qualifierKind, bool isMember)
: base(left.RelatedToken)
{
_left = left;
_right = right;
_isMember = isMember;
}
开发者ID:yslib,项目名称:minimvc,代码行数:7,代码来源:MemberAccessExpression.cs
示例5: Token
/// <summary>
/// Initializes an instance of the Token class.
/// </summary>
/// <param name="obj">The object.</param>
/// <param name="col">The column.</param>
/// <param name="line">The line.</param>
/// <param name="pos">The position.</param>
/// <param name="type">The type.</param>
public Token(dynamic obj, int col, int line, int pos, TokenId type)
{
Object = obj;
Column = col;
Line = line;
Position = pos;
Type = type;
}
开发者ID:Nacorpio,项目名称:cparser,代码行数:16,代码来源:Token.cs
示例6: Match
private bool Match(TokenId tokenID)
{
if (_token.Id == tokenID)
{
NextToken();
return true;
}
_errorReporter.TokenExpected(_token.Range, _token.Text, tokenID);
return false;
}
开发者ID:chenzuo,项目名称:nquery,代码行数:11,代码来源:Parser.cs
示例7: EvalBooleanOperator
private object EvalBooleanOperator(TokenId op, object lValue)
{
bool v = Util.ToBool(lValue);
switch (op)
{
case TokenId.Not: return !v;
}
throw new ParseException(string.Format("Unary not support, tokenId: '{0}', value: {1} at line: {2} column:{3}", RelatedToken.TokenId, lValue, RelatedToken.StartLocation.LineIndex + 1, RelatedToken.StartLocation.CharacterIndex + 1));
}
开发者ID:yslib,项目名称:minimvc,代码行数:11,代码来源:UnaryExpression.cs
示例8: EvalDecimalOperator
private object EvalDecimalOperator(TokenId op, decimal value)
{
switch (op)
{
case TokenId.Plus:
return value;
case TokenId.Minus:
return -value;
case TokenId.PlusPlus:
return ++value;
case TokenId.MinusMinus:
return --value;
default:
throw new ParseException(string.Format("Unary not support, tokenId: '{0}', value: {1} at line: {2} column:{3}", RelatedToken.TokenId, value, RelatedToken.StartLocation.LineIndex + 1, RelatedToken.StartLocation.CharacterIndex + 1));
}
}
开发者ID:yslib,项目名称:minimvc,代码行数:16,代码来源:UnaryExpression.cs
示例9: ValidateToken
void ValidateToken(TokenId t)
{
if (token.id != t) throw ParseError(ErrorMessages.SyntaxError);
}
开发者ID:kornarakis,项目名称:DynamicExpresso,代码行数:4,代码来源:ExpressionParser.cs
示例10: ValidateToken
/// <summary>Validates the current token is of the specified kind.</summary>
/// <param name="t">Expected token kind.</param>
internal void ValidateToken(TokenId t)
{
if (this.token.Id != t)
{
throw ParseError(Strings.RequestQueryParser_SyntaxError(this.textPos));
}
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:ExpressionLexer.cs
示例11: ValidateToken
private void ValidateToken(TokenId t, string errorMessage)
{
if (token.id != t) throw ParseError(errorMessage);
}
开发者ID:timbooker,项目名称:dotObjects,代码行数:4,代码来源:ExpressionParser.cs
示例12: FromTokenId
public static TokenInfo FromTokenId(TokenId tokenId)
{
return _infosById[tokenId];
}
开发者ID:chenzuo,项目名称:nquery,代码行数:4,代码来源:TokenInfo.cs
示例13: ValidateToken
private void ValidateToken(TokenId t)
{
if (this._token.Id != t)
throw this.ParseError("Syntax error", new object[0]);
}
开发者ID:RebelCMS,项目名称:rebelcmsxu5,代码行数:5,代码来源:ExpressionParser.cs
示例14: Token
/// <summary>
/// Initializes a new instance of the <see cref="Token"/> class with the specified ID and extension data.
/// </summary>
/// <remarks>
/// <para>This constructor is typically used for authentication requests which specified a <see cref="Token"/>
/// as the credentials.</para>
/// </remarks>
/// <param name="id">The unique ID of the token.</param>
/// <param name="extensionData">The extension data.</param>
/// <exception cref="ArgumentNullException">If <paramref name="extensionData"/> is <see langword="null"/>.</exception>
public Token(TokenId id, ImmutableDictionary<string, JToken> extensionData)
: base(extensionData)
{
_id = id;
}
开发者ID:sharwell,项目名称:openstack.net,代码行数:15,代码来源:Token.cs
示例15: HandleError
void IErrorReporter.TokenExpected(SourceRange sourceRange, string foundTokenText, TokenId expected)
{
string message = String.Format(CultureInfo.CurrentCulture, Resources.TokenExpected, foundTokenText, TokenInfo.FromTokenId(expected).Text);
HandleError(sourceRange, ErrorId.TokenExpected, message);
}
开发者ID:chenzuo,项目名称:nquery,代码行数:5,代码来源:ErrorProvider.cs
示例16: ValidateToken
void ValidateToken(TokenId t)
{
if (_token.id != t)
{
throw ParseError(SRResources.SyntaxError);
}
}
开发者ID:haoduotnt,项目名称:aspnetwebstack,代码行数:7,代码来源:DynamicQueryable.cs
示例17: ValidateToken
void ValidateToken(TokenId t)
{
if (_token.id != t)
throw CreateParseException(_token.pos, ErrorMessages.SyntaxError);
}
开发者ID:CooperLiu,项目名称:DynamicExpresso,代码行数:5,代码来源:Parser.cs
示例18: GetAliasedTokenId
static TokenId GetAliasedTokenId(TokenId t, string alias)
{
TokenId id;
return t == TokenId.Identifier && _predefinedAliases.TryGetValue(alias, out id) ? id : t;
}
开发者ID:MassimoLombaSem,项目名称:System.Linq.Dynamic,代码行数:5,代码来源:ExpressionParser.cs
示例19: TokenInfo
private TokenInfo(TokenId tokenId, string text, bool isKeyword, bool isQueryKeyword, UnaryOperator unOp, BinaryOperator binOp)
{
_tokenId = tokenId;
_text = text;
_isKeyword = isKeyword;
_isQueryKeyword = isQueryKeyword;
_unaryOperator = unOp;
_binaryOperator = binOp;
}
开发者ID:chenzuo,项目名称:nquery,代码行数:9,代码来源:TokenInfo.cs
示例20: PostAuthenticate
public HttpResponseMessage PostAuthenticate([FromBody] AuthenticationRequest authenticationRequest)
{
MediaTypeHeaderValue acceptedType = new MediaTypeHeaderValue("application/json");
MediaTypeHeaderValue contentType = Request.Content.Headers.ContentType;
if (!HttpApiCall.IsAcceptable(acceptedType, contentType))
return new HttpResponseMessage(HttpStatusCode.BadRequest);
ValidateRequest(Request);
if (authenticationRequest == null)
return new HttpResponseMessage(HttpStatusCode.BadRequest);
AuthenticationData authenticationData = authenticationRequest.AuthenticationData;
if (authenticationData == null)
return new HttpResponseMessage(HttpStatusCode.BadRequest);
if (authenticationData.TenantName != null
&& !string.Equals(authenticationData.TenantName, _tenantName, StringComparison.OrdinalIgnoreCase))
return new HttpResponseMessage(HttpStatusCode.Unauthorized);
if (authenticationData.TenantId != null
&& authenticationData.TenantId != new ProjectId(_tenantId))
{
return new HttpResponseMessage(HttpStatusCode.Unauthorized);
}
if (authenticationData.Token != null)
throw new NotImplementedException();
PasswordCredentials passwordCredentials = authenticationData.PasswordCredentials;
if (passwordCredentials == null)
return new HttpResponseMessage(HttpStatusCode.BadRequest);
if (!string.Equals(passwordCredentials.Username, _username, StringComparison.OrdinalIgnoreCase)
|| !string.Equals(passwordCredentials.Password, _password, StringComparison.Ordinal))
{
return new HttpResponseMessage(HttpStatusCode.Unauthorized);
}
bool hasTenant = authenticationData.TenantId != null || authenticationData.TenantName != null;
string responseBody;
if (hasTenant)
responseBody = IdentityServiceResources.AuthenticateResponseTemplate;
else
responseBody = IdentityServiceResources.AuthenticateWithoutTenantResponseTemplate;
lock (_lock)
{
var parameters = new Dictionary<string, string>();
// expire the token 5 minutes early
if (!_tokenExpires.HasValue || _tokenExpires < DateTimeOffset.Now - TimeSpan.FromMinutes(5))
{
// generate a new token
_tokenCreated = DateTimeOffset.Now;
_tokenExpires = _tokenCreated + TimeSpan.FromHours(24);
_tokenId = new TokenId(Guid.NewGuid().ToString());
}
parameters["issued_at"] = JsonConvert.SerializeObject(_tokenCreated.Value);
parameters["expires"] = JsonConvert.SerializeObject(_tokenExpires.Value);
parameters["tokenId"] = JsonConvert.SerializeObject(_tokenId);
parameters["tenantId"] = JsonConvert.SerializeObject(_tenantId);
parameters["tenantName"] = JsonConvert.SerializeObject(_tenantName);
parameters["username"] = JsonConvert.SerializeObject(_username);
parameters["userId"] = JsonConvert.SerializeObject(_userId);
parameters["userFullName"] = JsonConvert.SerializeObject(_userFullName);
foreach (var pair in parameters)
responseBody = responseBody.Replace("{" + pair.Key + "}", JsonConvert.DeserializeObject<string>(pair.Value));
}
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new StringContent(responseBody, Encoding.UTF8, "application/json");
return result;
}
开发者ID:sharwell,项目名称:openstack.net,代码行数:77,代码来源:IdentityController.cs
注:本文中的TokenId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论