{"id":15848878,"url":"https://github.com/alexellis/csharp-openfaas-secret-example","last_synced_at":"2025-04-01T17:49:30.942Z","repository":{"id":47462914,"uuid":"144622004","full_name":"alexellis/csharp-openfaas-secret-example","owner":"alexellis","description":"Example showing how to make use of secrets with CSharp and OpenFaaS","archived":false,"fork":false,"pushed_at":"2018-08-13T19:26:29.000Z","size":3,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T11:52:25.587Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexellis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-13T19:03:11.000Z","updated_at":"2020-08-26T05:14:33.000Z","dependencies_parsed_at":"2022-09-23T07:22:59.983Z","dependency_job_id":null,"html_url":"https://github.com/alexellis/csharp-openfaas-secret-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fcsharp-openfaas-secret-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fcsharp-openfaas-secret-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fcsharp-openfaas-secret-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fcsharp-openfaas-secret-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexellis","download_url":"https://codeload.github.com/alexellis/csharp-openfaas-secret-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246685274,"owners_count":20817588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-05T18:20:50.602Z","updated_at":"2025-04-01T17:49:30.917Z","avatar_url":"https://github.com/alexellis.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"csharp-secret\n===================\n\nThis OpenFaaS sample shows how to use an api-key secret to add authentication to a function.\n\n```sh\nKEY=$(head -c 2048 /dev/urandom | shasum | cut -d \" \" -f 1)\necho -n $KEY | docker secret create api-key -\n\necho \"Your key is: $KEY\"\n09f62255f206eea5ae0481feadc22d3092706b4a\n\n# Replace my Docker Hub Account for yours:\n\nsed -ie s/alexellis2/yourdockerhubname/g stack.yml\n\n# Build / push / deploy\n\nfaas-cli build \\\n \u0026\u0026 faas-cli push \\\n \u0026\u0026 faas-cli deploy\n\n# Invoke the function without passing the Authorization header:\n\ncurl http://127.0.0.1:8080/function/csharp-secret -i\nHTTP/1.1 500 Internal Server Error\nContent-Length: 27\nContent-Type: text/plain; charset=utf-8\nDate: Mon, 13 Aug 2018 19:02:59 GMT\nX-Call-Id: c0f9f0a6-574f-4f82-af8e-c556076d7360\nX-Start-Time: 1534186979552841505\n\nexit status 1\nunauthorized\n\n# Now try with the Authorization header:\n\ncurl http://127.0.0.1/function/csharp-secret -i -H \"Authorization: Bearer 09f62255f206eea5ae0481feadc22d3092706b4a\"\nHTTP/1.1 200 OK\nContent-Length: 16\nContent-Type: text/plain; charset=utf-8\nDate: Mon, 13 Aug 2018 19:02:48 GMT\nX-Call-Id: 73ab26a4-76aa-41e1-b650-713bbb1b749f\nX-Duration-Seconds: 0.068224\nX-Start-Time: 1534186968746336001\n\nAuthorized.. OK\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexellis%2Fcsharp-openfaas-secret-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexellis%2Fcsharp-openfaas-secret-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexellis%2Fcsharp-openfaas-secret-example/lists"}