Skip to content

Instantly share code, notes, and snippets.

View vagnercotrim's full-sized avatar
🏍️
...

Vagner Oliveira Cotrim vagnercotrim

🏍️
...
  • Tribunal de Contas do Estado de Rondônia - TCERO
  • Porto Velho - RO
View GitHub Profile
@JaimeStill
JaimeStill / README.md
Last active October 21, 2025 11:59
ASP.NET Core Active Directory Integration

Active Directory Authentication

This will provide an example of integrating Active Directory authentication in an ASP.NET Core app.

Note, you'll need to be running on a Windows domain with Visual Studio debugging in IIS Express for this to work.

Setup

In launchSettings.json, you'll want to modify iisSettings by turning on windowsAuthentication:

@wellingtonjhn
wellingtonjhn / AuthenticatedUser.cs
Created April 29, 2018 23:08
Authenticated User - IHttpContextAccessor
public class AuthenticatedUser
{
private readonly IHttpContextAccessor _accessor;
public AuthenticatedUser(IHttpContextAccessor accessor)
{
_accessor = accessor;
}
public string Email => _accessor.HttpContext.User.Identity.Name;
@jcorderodr
jcorderodr / ADUserProperty.cs
Last active September 9, 2025 03:09
ActiveDirectory Basic Management on C#
using System;
//Class from: http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/all-operations-on-active-directory-ad-using-C-Sharp/
namespace TestAD.ActiveDirectory
{
class ADUserProperty
{
public const String DESCRIPTION = "description";
@unr
unr / main.js
Created March 21, 2017 15:01
Simplistic Axios in VueJs Example
const axiosconfig = {
baseurl: 'https://site.com/api/',
timeout: 30000,
};
import Vue from 'vue';
import axios from 'axios';
// Setting up Axios on Vue Instance, for use via this.$axios
Vue.prototype.$axios = axios.create(axiosConfig);
@pysco68
pysco68 / startup.cs
Last active August 29, 2015 14:12
Use NLog as OWIN logger factory
// first install the Nuget Package with:
// Install-Package Pysco68.Owin.Logging.NLogAdapter
// add this reference
using Pysco68.Owin.Logging.NLogAdapter;
public class Startup
{
public void Configuration(IAppBuilder app)
{
@hallem
hallem / RestSharp_FileAsBody.cs
Last active December 29, 2024 21:10
RestSharp file as body
public RestApiResponse<bool> PutEnvelopesDocuments(string envelopeId, string documentId, string fullFileName, byte[] documentBytes)
{
RestRequest request = GetBaseRequest("envelopes/{envelopeId}/documents/{documentId}", Method.PUT);
request.AddUrlSegment("envelopeId", envelopeId);
request.AddUrlSegment("documentId", documentId);
request.AddHeader("Content-Type", "application/pdf");
request.AddHeader("Content-Disposition",
string.Format("file; filename=\"{0}\"; documentid={1}; fileExtension=\"{2}\"",
Path.GetFileNameWithoutExtension(fullFileName), documentId, Path.GetExtension(fullFileName)));
@indus
indus / in.ts
Last active March 4, 2021 19:12
Typescript Pattern for Vue Components
module MyModule {
export class MyClass extends Vue {
// define instance methods
myMethod() {
// the TS-Type of "this" is defined as Instance of MyClass
console.log("myMethod");
}
myOtherMethod() {
console.log("myOtherMethod");
@staltz
staltz / introrx.md
Last active March 21, 2026 07:17
The introduction to Reactive Programming you've been missing
@eibrahim
eibrahim / MyEmberJsonMediaTypeFormatter.cs
Last active December 10, 2016 15:04
A JSON formatter for ASP.NET Web API to support Ember Data
public class MyEmberJsonMediaTypeFormatter : JsonMediaTypeFormatter
{
private int _maxDepth = 256;
private JsonSerializerSettings _jsonSerializerSettings;
public MyEmberJsonMediaTypeFormatter()
{
_jsonSerializerSettings = CreateDefaultSerializerSettings();
}
public override System.Threading.Tasks.Task WriteToStreamAsync(System.Type type, object value, System.IO.Stream writeStream, System.Net.Http.HttpContent content, System.Net.TransportContext transportContext)
{
'use strict';
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
var gulp = require('gulp');
var open = require('open');
var wiredep = require('wiredep').stream;
// Load plugins
var $ = require('gulp-load-plugins')();