namespace LaaProductionWeb.API.Areas.Account.Controllers { using LaaProductionWeb.Standart.Interfaces; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Text; public class FunctionsController : AccountBaseController { public FunctionsController(IAccountService accountService) : base(accountService) { } [HttpGet] public ActionResult> Get([FromHeader(Name = "Authorization")]string bearer) { var values = bearer .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .Select(x => Encoding.UTF8.GetString(Convert.FromBase64String(x))) .LastOrDefault() ?.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty(); if (values.Length != 3 || !short.TryParse(values[0], out short appId)) { return this.BadRequest("Endpoint expects bearer authorization header with appId:username:password base64 encoded."); } var username = values[1]; var password = values[2]; var functions = this.accountService.FindUserFunctions(appId, username, password); return this.Ok(functions); } } }