jpsider / RestPS

Simple ReST Framework for Powershell
MIT License
112 stars 30 forks source link

Added the option to add headers in the response #69

Closed chbwien closed 1 year ago

chbwien commented 1 year ago

Hi!

I added the option to add headers in the response and added an example how to use it for a simple basic authentication challenge. I hope those simple lines will help.

jpsider commented 1 year ago

I'm working on this now. Looks like some things changed with AppVeyor - so I need to figure out the new stuff.

jpsider commented 1 year ago

well, that was exciting. Finally got it to publish. Let me know how it works! I saw all tests passed from a regression standpoint. Thanks for the contribution!!

chbwien commented 1 year ago

It work's but there is a copy/paste error in the restpsroutes.json. The test for the basic auth should use a different URL than process.

BTW, if you want to send back a html instead of a json (therefore the basic auth challenge), just set: $script:ResponseContentType = 'text/html; charset=UTF8'

You can then use the REST server to send human readable data to browsers (with basic auth).

And one more hint: If you want to check the credentials on an AD, just use: $myval = (New-Object DirectoryServices.DirectoryEntry "",$myuser,$mypass).psbase.name -ne $null

All the best

-- Christian

------ Originalnachricht ------ Von "Justin Sider" @.> An "jpsider/RestPS" @.> Cc "Christian Beck" @.>; "Author" @.> Datum 06.12.2022 00:02:26 Betreff Re: [jpsider/RestPS] Added the option to add headers in the response (PR #69)

well, that was exciting. Finally got it to publish. Let me know how it works! I saw all tests passed from a regression standpoint. Thanks for the contribution!!

— Reply to this email directly, view it on GitHub https://github.com/jpsider/RestPS/pull/69#issuecomment-1338296857, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABV22J7MGCS5XISCSGTKQELWLZYAFANCNFSM6AAAAAASDRNR4Y. You are receiving this because you authored the thread.Message ID: @.***>