This commit is contained in:
@@ -10,7 +10,27 @@ Imports System.IO
|
|||||||
Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||||
|
|
||||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||||
context.Response.ContentType = "text/plain"
|
If context.Request("metodo").ToString() = "GetTokenAngular" Then
|
||||||
|
'context.Response.ContentType = "application/json; charset=utf-8"
|
||||||
|
|
||||||
|
context.Response.ContentType = "text/json"
|
||||||
|
Dim origin As String = context.Request.UrlReferrer.ToString()
|
||||||
|
context.Response.AddHeader("Access-Control-Allow-Origin", origin.Substring(0, origin.Length - 1))
|
||||||
|
'context.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:4200")
|
||||||
|
'context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST")
|
||||||
|
context.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept")
|
||||||
|
context.Response.AddHeader("Access-Control-Allow-Credentials", "true")
|
||||||
|
context.Response.StatusCode = 200
|
||||||
|
Dim key As String = GetTokenAngular(context)
|
||||||
|
Dim json As String = JsonConvert.SerializeObject(key)
|
||||||
|
context.Response.Write(json)
|
||||||
|
context.Response.Flush()
|
||||||
|
context.Response.Close()
|
||||||
|
context.Response.End()
|
||||||
|
Else
|
||||||
|
context.Response.ContentType = "text/plain"
|
||||||
|
End If
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Select Case context.Request("metodo")
|
Select Case context.Request("metodo")
|
||||||
Case "getps"
|
Case "getps"
|
||||||
@@ -53,10 +73,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
|||||||
context.Response.Write(sendMail(context))
|
context.Response.Write(sendMail(context))
|
||||||
Case "sendMailLPM"
|
Case "sendMailLPM"
|
||||||
context.Response.Write(sendMailLPM(context))
|
context.Response.Write(sendMailLPM(context))
|
||||||
Case "GetTokenAngular"
|
|
||||||
context.Response.Write(GetTokenAngular(context))
|
|
||||||
context.Response.End()
|
|
||||||
|
|
||||||
End Select
|
End Select
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
ex.GuardaLog(ex.Message)
|
ex.GuardaLog(ex.Message)
|
||||||
@@ -74,11 +90,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
|||||||
Microsoft.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256Signature)}
|
Microsoft.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256Signature)}
|
||||||
Dim tokenHandler = New System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler()
|
Dim tokenHandler = New System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler()
|
||||||
Dim newtoken = tokenHandler.CreateToken(tokenDescriptor)
|
Dim newtoken = tokenHandler.CreateToken(tokenDescriptor)
|
||||||
'context.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:4200")
|
|
||||||
'context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST")
|
|
||||||
'context.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept")
|
|
||||||
context.Response.AddHeader("Access-Control-Allow-Credentials", true )
|
|
||||||
context.Response.StatusCode = 200
|
|
||||||
Dim stokenn As String = tokenHandler.WriteToken(newtoken)
|
Dim stokenn As String = tokenHandler.WriteToken(newtoken)
|
||||||
Return stokenn
|
Return stokenn
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user