neu
This commit is contained in:
@@ -1,6 +1,90 @@
|
||||
Public Class CHMRC
|
||||
Imports System.Net.Http
|
||||
Imports System.Web
|
||||
Imports System
|
||||
Imports Microsoft.AspNetCore.Authentication.Cookies
|
||||
Imports Microsoft.AspNetCore.Builder
|
||||
Imports Microsoft.AspNetCore.Hosting
|
||||
Imports Microsoft.AspNetCore.Http
|
||||
Imports Microsoft.Extensions.Configuration
|
||||
Imports Microsoft.Extensions.DependencyInjection
|
||||
Imports Microsoft.Extensions.Hosting
|
||||
|
||||
'Public Class Startup
|
||||
' Public Sub New(ByVal configuration As IConfiguration)
|
||||
' configuration = configuration
|
||||
' End Sub
|
||||
|
||||
' Public ReadOnly Property Configuration As IConfiguration
|
||||
|
||||
' Public Sub ConfigureServices(ByVal services As IServiceCollection)
|
||||
' services.Configure(Configuration)
|
||||
|
||||
' services.Configure(Of CookiePolicyOptions)(Function(options)
|
||||
' options.CheckConsentNeeded = Function(context) True
|
||||
' options.MinimumSameSitePolicy = SameSiteMode.None
|
||||
' End Function)
|
||||
' services.AddSession(Function(options)
|
||||
' options.IdleTimeout = TimeSpan.FromSeconds(10)
|
||||
' options.Cookie.HttpOnly = True
|
||||
' options.Cookie.IsEssential = True
|
||||
' End Function)
|
||||
' services.AddAuthentication(Function(options)
|
||||
' options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme
|
||||
' options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme
|
||||
' options.DefaultChallengeScheme = "HMRC"
|
||||
' End Function).AddCookie().AddOAuth("HMRC", Function(options)
|
||||
' options.ClientId = Configuration("clientId")
|
||||
' options.ClientSecret = Configuration("clientSecret")
|
||||
' options.CallbackPath = New PathString(Configuration("oauthCallbackUri"))
|
||||
' options.Scope.Add("hello")
|
||||
' options.SaveTokens = True
|
||||
' options.AuthorizationEndpoint = Configuration("uri") & "/oauth/authorize"
|
||||
' options.TokenEndpoint = Configuration("uri") & "/oauth/token"
|
||||
' End Function)
|
||||
' services.AddRazorPages(Function(options)
|
||||
' options.Conventions.AddPageRoute("/HelloWorld/Index", "")
|
||||
' End Function)
|
||||
' End Sub
|
||||
|
||||
' Public Sub Configure(ByVal app As IApplicationBuilder, ByVal env As IWebHostEnvironment)
|
||||
' If env.IsDevelopment() Then
|
||||
' app.UseDeveloperExceptionPage()
|
||||
' Else
|
||||
' app.UseExceptionHandler("/Error")
|
||||
' app.UseHsts()
|
||||
' End If
|
||||
|
||||
' app.UseHttpsRedirection()
|
||||
' app.UseStaticFiles()
|
||||
' app.UseRouting()
|
||||
' app.UseAuthorization()
|
||||
' app.UseAuthentication()
|
||||
' app.UseSession()
|
||||
' app.UseCookiePolicy()
|
||||
' app.UseEndpoints(Function(endpoints)
|
||||
' endpoints.MapRazorPages()
|
||||
' endpoints.MapControllerRoute(name:="default", pattern:="{controller=HelloWorld}/{action=Index}")
|
||||
' End Function)
|
||||
' End Sub
|
||||
'End Class
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Public Class CHMRC
|
||||
|
||||
Shared Sub hmrcTEST()
|
||||
'Dim client As HttpClient = HttpClientBuilder.create().build()
|
||||
'Dim request As HttpGet = New HttpGet("https://test-api.service.hmrc.gov.uk/hello/world")
|
||||
'request.addHeader("Accept", "application/vnd.hmrc.1.0+json")
|
||||
'Dim response As HttpResponse = client.execute(request)
|
||||
'Dim statusCode As Integer = response.getStatusLine().getStatusCode()
|
||||
'Dim responseBody As String = EntityUtils.toString(response.getEntity())
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
Debug.WriteLine("HMRC Start")
|
||||
Dim oauth2 As Chilkat.OAuth2 = New Chilkat.OAuth2()
|
||||
Dim success As Boolean
|
||||
@@ -103,7 +187,8 @@
|
||||
|
||||
Debug.WriteLine(json.Emit())
|
||||
Dim fac As Chilkat.FileAccess = New Chilkat.FileAccess()
|
||||
fac.WriteEntireTextFile("qa_data/tokens/hmrc.json", json.Emit(), "utf-8", False)
|
||||
'fac.WriteEntireTextFile("qa_data/tokens/hmrc.json", json.Emit(), "utf-8", False)
|
||||
fac.WriteEntireTextFile("C:\Users\DEVELOPER1\Desktop\hmrc.json", json.Emit(), "utf-8", False)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user