I hereby claim:
- I am jpda on github.
- I am jpda (https://keybase.io/jpda) on keybase.
- I have a public key whose fingerprint is 57E2 0A64 15FC 9288 006C 0E20 1B0E B0CE C35D 3922
To claim this, I am signing this object:
| public static void CreateIndexFromType(Type t) | |
| { | |
| var indexName = t.Name.ToLower(); | |
| if (SearchClient.Indexes.Exists(indexName)) | |
| { | |
| Trace.WriteLine("Found existing index, deleting..."); | |
| SearchClient.Indexes.Delete(indexName); | |
| } | |
| try |
| internal class Delay | |
| { | |
| public TimeSpan DelayTime { get; set; } | |
| public int Multiplier { get; set; } | |
| public TimeSpan ResetTime { get; set; } | |
| public int TerminationThreshold { get; set; } | |
| } | |
| internal class DelayManager | |
| { |
| Param ( | |
| [string]$IP,[string]$Name,[string]$Password | |
| ) | |
| $stockPass = ConvertTo-SecureString "p@ssw0rd" -AsPlainText -Force # Default password | |
| $securePass = ConvertTo-SecureString $Password -AsPlainText -Force # new target password | |
| $stockCreds = New-Object System.Management.Automation.PSCredential("$IP\Administrator", $stockPass) | |
| $newCreds = New-Object System.Management.Automation.PSCredential("$IP\Administrator", $securePass) | |
| Get-Service -Name WinRM | Start-Service -Verbose # Ensure WS-Man is started |
| param ( | |
| [string][Parameter(Mandatory = $true)]$DeviceName, | |
| [string][Parameter(Mandatory = $false)]$DefaultAppName = "IotCoreDefaultApp", | |
| [string][Parameter(Mandatory = $true)]$TargetAppName, | |
| [string][Parameter(Mandatory = $true)]$TargetAppPath, | |
| [string][Parameter(Mandatory = $true)]$DeviceUsername, | |
| [string][Parameter(Mandatory = $true)]$DevicePassword | |
| ) | |
| $ErrorActionPreference = "Stop" | |
| Add-Type -Path "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Net.Http.dll" |
| <?xml version="1.0"?> | |
| <configuration> | |
| <appSettings> | |
| <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> | |
| </appSettings> | |
| <system.web> | |
| <compilation debug="true" targetFramework="4.5" /> | |
| <httpRuntime targetFramework="4.5"/> | |
| </system.web> | |
| <system.serviceModel> |
| <?xml version="1.0" encoding="utf-8" ?> | |
| <configuration> | |
| <startup> | |
| <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | |
| </startup> | |
| <system.serviceModel> | |
| <bindings> | |
| <basicHttpBinding> | |
| <binding name="BasicHttpBinding_IAuthService" /> | |
| </basicHttpBinding> |
| private static readonly string ClientId = ConfigurationManager.AppSettings["ida:ClientId"]; | |
| private static readonly string AadInstance = ConfigurationManager.AppSettings["ida:AADInstance"]; | |
| private static readonly string TenantId = ConfigurationManager.AppSettings["ida:TenantId"]; | |
| private static readonly string PostLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"]; | |
| private static readonly string Authority = AadInstance + TenantId; | |
| private static readonly string TargetResourceId = ConfigurationManager.AppSettings["ida:TargetResourceId"]; | |
| public void ConfigureAuth(IAppBuilder app) | |
| { | |
| app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); | |
| app.UseCookieAuthentication(new CookieAuthenticationOptions()); |
I hereby claim:
To claim this, I am signing this object:
| using System; | |
| using System.Linq; | |
| using System.Threading.Tasks; | |
| using Microsoft.Azure.ServiceBus; | |
| using Microsoft.Azure.ServiceBus.Filters; | |
| namespace ConsoleApp2 | |
| { | |
| class Program | |
| { |
| private static string GetUserToken() | |
| { | |
| var cid = "<application client ID>"; | |
| var targetCid = "<target resource ID - be careful here, some apps require client/resource ID (GUID), others also accept a URI"; | |
| var key = "<URL-encoded client secret key>"; | |
| var reqUri = "<authority, usually something like https://login.microsoftonline.com/<tenant ID or domain name>/oauth2/token"; | |
| var postData = $"resource={targetCid}&client_id={cid}&grant_type=password&username=user%40jpda.onmicrosoft.com&password={password}&type=openid&client_secret={key}"; | |
| // example: "resource=00000002-0000-0000-c000-000000000000&client_id=eeb7d568-2e05-45cf-87eb-d07604340af7&grant_type=password&username=user%40jpda.onmicrosoft.com&password=lol&scope=openid&client_secret=urlencodedsecretkey" |