Development

Retrieve and Export BitBucket server users

Sometimes, we wish to check if a BitBucket user has actually used his account or not. There is a post Query for inactive or idle users which has explained few different ways. I will try the API method. In this exercise, I try to achieve few things below with Python Send request to BitBucket server and get the list of users Convert the Unix timestamp to readable date time Export the user data to a csv file This is the sample code to get the information and export to csv file.

Simple Dependency Injection with dynamic finder at runtime

Sometimes, we have multiple methods to be called, but it has to be determined at run time, so try to make it less coupled and use reflection to achieve this. The sample scenario here is for Field Type. We have different implementation for each different field type, such as text, date etc., and at run time, a DoSomething method should be called based on the field type. Firstly, an interface is defined, which has methods called IsValid and DoSomething, IsValid method is used for a certain implementation which is valid for certain Fieldtype.

Accessing Jira with OAuth Authenticated request

Based on Jira OAuth authentication using DotNetAuth, we can successfully get the access token, and are able to make an authenticated request. Now we plan to use Atlassian.SDK to access Jira with oAuth authentication, but currently Atlassian.SDK only supports basic authentication. So we will need to inject little bit extra code to make this happen. Used packages Atlassian.SDK 8.5.0 RestSharp 105.2.3 DotNetAuth Current DotNetAuth 1.0.5 nuget package uses old RestSharp version, and it doesn’t work with RestSharp 105.

Jira OAuth authentication using DotNetAuth

In this post, we will try to connect to Jira with oAuth authentication in DotNet, I did some research, and mainly followed the instructions on Is there any JIRA OAuth implementation example in .NET and JIRA REST API Example – OAuth authentication Generate self-signed certificate OpenSSL is used for generating the certificate, openssl genrsa -des3 -out private.pem 2048 openssl rsa -in private.pem -outform PEM -pubout -out public.pem openssl pkcs8 -topk8 -nocrypt -in private.