public static void SetContextByConifg(OAuth2Context context) { var value = configuration[string.Format("OAuth2Authorize:{0}", context.ConfigKey)]; Context result; if (!m_Contexts.TryGetValue(value, out result)) { string id = null, secret = null; var match = m_rId.Match(value); if (match.Success) { id = match.Groups[1].Value.Trim(); } else { throw new Exception("配置中不包含id值"); } match = m_rSecret.Match(value); if (match.Success) { secret = match.Groups[1].Value.Trim(); } else { throw new Exception("配置中不包含secret值"); } result = new Context(id, secret); } context.Set(result); }
public OAuth2Identity(OAuth2Context context, string accessToken, string scope) : base(context) { this.access_token = accessToken; this.scope = scope; }
public OAuth2Identity(OAuth2Context context, string accessToken) : this(context, accessToken, null) { }
public OAuth2ClientIdentity(OAuth2Context context) : this(context.ClientId, context.ClientSecret) { }
public static void Load(string configKey) { m_Current = new OAuth2Context(configKey); }