Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83bad8424c | ||
|
|
788ef3a1db | ||
|
|
b2094b9c4f | ||
|
|
e51b69cf8f | ||
|
|
c083049ce3 | ||
|
|
d7947f010a | ||
|
|
bc4767f479 | ||
|
|
fb60718771 | ||
|
|
c596c7787c |
26
Gemfile.lock
Normal file
26
Gemfile.lock
Normal file
@@ -0,0 +1,26 @@
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
albacore (2.0.4)
|
||||
map (~> 6.5)
|
||||
nokogiri (~> 1.5)
|
||||
rake (> 10)
|
||||
semver2 (~> 3.4)
|
||||
map (6.6.0)
|
||||
mini_portile2 (2.0.0)
|
||||
nokogiri (1.6.7.2-x64-mingw32)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
os (0.9.6)
|
||||
rake (11.1.1)
|
||||
semver2 (3.4.2)
|
||||
|
||||
PLATFORMS
|
||||
x64-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
albacore
|
||||
nokogiri
|
||||
os
|
||||
|
||||
BUNDLED WITH
|
||||
1.12.1
|
||||
17
Rakefile.rb
17
Rakefile.rb
@@ -15,8 +15,7 @@ PACKAGES = File.expand_path("packages")
|
||||
TOOLS = File.expand_path("tools")
|
||||
NUGET = File.expand_path("#{TOOLS}/nuget")
|
||||
NUGET_EXE = File.expand_path("#{TOOLS}/nuget/nuget.exe")
|
||||
@version = ENV['APPVEYOR_REPO_TAG_NAME'] || '0.0.1-alpha1'
|
||||
@version = @version.sub "v", ""
|
||||
@version = "2.8.0"
|
||||
PROJECTS = Dir.glob('src/*').select{|dir| File.directory? dir }
|
||||
|
||||
desc 'Retrieve things'
|
||||
@@ -64,20 +63,10 @@ end
|
||||
|
||||
desc 'publish nugets'
|
||||
task :nuspec_publish do
|
||||
repoTag = ENV['APPVEYOR_REPO_TAG']
|
||||
nugetKey = ENV['NUGET_KEY']
|
||||
puts nugetKey
|
||||
if repoTag != 'true';
|
||||
puts 'not publishing since APPVEYOR_REPO_TAG has not been set. Please add a github tag'
|
||||
else
|
||||
PROJECTS.each{|dir|
|
||||
Dir.chdir(dir) do
|
||||
sh "#{NUGET_EXE} push #{FileList["*.nupkg"].first} -ApiKey #{nugetKey}"
|
||||
sh "#{NUGET_EXE} push #{FileList["*.nupkg"].first}"
|
||||
end
|
||||
}
|
||||
sh "#{NUGET_EXE} push #{FileList["*.nupkg"].first} -ApiKey #{nugetKey}"
|
||||
end
|
||||
|
||||
|
||||
|
||||
sh "#{NUGET_EXE} push #{FileList["*.nupkg"].first}"
|
||||
end
|
||||
|
||||
@@ -3,12 +3,8 @@ nuget:
|
||||
project_feed: true
|
||||
install:
|
||||
- set PATH=C:\Ruby22\bin;%PATH%
|
||||
- set
|
||||
- bundle install
|
||||
build_script:
|
||||
- rake publish
|
||||
- rake preflight
|
||||
artifacts:
|
||||
- path: src\**\*.nupkg
|
||||
environment:
|
||||
NUGET_KEY:
|
||||
secure: 5m1zupizmNvVwCg2MDUkRGQbbVfNypLo9yCstTAXQ5KHDypBe5RrGKi1HnEAhAy8
|
||||
@@ -187,7 +187,12 @@ namespace Owin.Security.Providers.Salesforce
|
||||
var state = Options.StateDataFormat.Protect(properties);
|
||||
|
||||
var authorizationEndpoint =
|
||||
$"{Options.Endpoints.AuthorizationEndpoint}?response_type={"code"}&client_id={Options.ClientId}&redirect_uri={HttpUtility.UrlEncode(redirectUri)}&display={"page"}&immediate={false}&state={Uri.EscapeDataString(state)}&scope={""}";
|
||||
$"{Options.Endpoints.AuthorizationEndpoint}?response_type={"code"}&client_id={Options.ClientId}&redirect_uri={HttpUtility.UrlEncode(redirectUri)}&display={"page"}&immediate={false}&state={Uri.EscapeDataString(state)}";
|
||||
|
||||
if (Options.Scope != null && Options.Scope.Count > 0)
|
||||
{
|
||||
authorizationEndpoint += $"&scope={string.Join(" ", Options.Scope)}";
|
||||
}
|
||||
|
||||
if (Options.Prompt != null)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,8 @@ namespace Owin.Security.Providers.Slack.Provider
|
||||
/// <param name="user">The JSON-serialized user</param>
|
||||
/// <param name="accessToken">Slack Access token</param>
|
||||
/// <param name="scope">Indicates access level of application</param>
|
||||
public SlackAuthenticatedContext(IOwinContext context, JObject user, string accessToken, string scope)
|
||||
/// <param name="incomingWebhook">Contains channel infomation about the choosen default channel</param>
|
||||
public SlackAuthenticatedContext(IOwinContext context, JObject user, string accessToken, string scope, JObject incomingWebhook)
|
||||
: base(context)
|
||||
{
|
||||
User = user;
|
||||
@@ -28,6 +29,14 @@ namespace Owin.Security.Providers.Slack.Provider
|
||||
TeamId = TryGetValue(user, "team_id");
|
||||
TeamName = TryGetValue(user, "team");
|
||||
TeamUrl = TryGetValue(user, "url");
|
||||
if (incomingWebhook != null)
|
||||
{
|
||||
ChannelId = TryGetValue(incomingWebhook, "channel_id");
|
||||
ChannelName = TryGetValue(incomingWebhook, "channel");
|
||||
ConfigurationUrl = TryGetValue(incomingWebhook, "configuration_url");
|
||||
HooksUrl = TryGetValue(incomingWebhook, "url");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -73,6 +82,27 @@ namespace Owin.Security.Providers.Slack.Provider
|
||||
/// </summary>
|
||||
public string UserName { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the channel choose at oauth time
|
||||
/// </summary>
|
||||
public string ChannelName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the channel ID of the channel choosen at oauth time
|
||||
/// </summary>
|
||||
public string ChannelId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the confiquration url
|
||||
/// </summary>
|
||||
public string ConfigurationUrl { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hook url
|
||||
/// </summary>
|
||||
public string HooksUrl { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="ClaimsIdentity"/> representing the user
|
||||
/// </summary>
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Owin.Security.Providers.Slack
|
||||
dynamic response = JsonConvert.DeserializeObject<dynamic>(text);
|
||||
var accessToken = (string)response.access_token;
|
||||
var scope = (string)response.scope;
|
||||
|
||||
var incomingWebhookChannelInfo = response.incoming_webhook;
|
||||
// Get the Slack user
|
||||
var userRequest = new HttpRequestMessage(HttpMethod.Get, UserInfoEndpoint + "?token=" + Uri.EscapeDataString(accessToken));
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Owin.Security.Providers.Slack
|
||||
text = await userResponse.Content.ReadAsStringAsync();
|
||||
var user = JObject.Parse(text);
|
||||
|
||||
var context = new SlackAuthenticatedContext(Context, user, accessToken, scope)
|
||||
var context = new SlackAuthenticatedContext(Context, user, accessToken, scope, incomingWebhookChannelInfo)
|
||||
{
|
||||
Identity = new ClaimsIdentity(
|
||||
Options.AuthenticationType,
|
||||
@@ -131,6 +131,10 @@ namespace Owin.Security.Providers.Slack
|
||||
{
|
||||
context.Identity.AddClaim(new Claim(ClaimTypes.Webpage, context.TeamUrl, XmlSchemaString, Options.AuthenticationType));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(context.ChannelId))
|
||||
{
|
||||
context.Identity.AddClaim(new Claim("urn:slack:channel_id", context.ChannelId, XmlSchemaString, Options.AuthenticationType));
|
||||
}
|
||||
context.Properties = properties;
|
||||
|
||||
await Options.Provider.Authenticated(context);
|
||||
|
||||
Reference in New Issue
Block a user