Last active
          April 28, 2021 16:23 
        
      - 
      
 - 
        
Save zahedshareef/a3785d7067bc510d64f0befedaacd803 to your computer and use it in GitHub Desktop.  
    Sample Og Stack Client Enrollment API in .NET Core
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | namespace ServiceProviderSolution.Controllers | |
| { | |
| [Route("api/v1/subscriptions")] | |
| [ApiController] | |
| public class SubscriptionsController : ControllerBase | |
| { | |
| private readonly IEnrollmentService _enrollmentService; | |
| public SubscriptionsController(IEnrollmentService enrollmentService) | |
| { | |
| _enrollmentService = enrollmentService; | |
| } | |
| [HttpPost("init")] | |
| public async Task<IActionResult> Init([FromBody] InitRequest payload) | |
| { | |
| await _enrollmentService.InitService(input); | |
| return Ok(); | |
| } | |
| [HttpPost] | |
| public async Task<IActionResult> Enroll([FromBody] EncryptedEnrollmentRequest payload) | |
| { | |
| await _enrollmentService.EnrollService(input); | |
| return Ok(); | |
| } | |
| [HttpDelete("{id}")] | |
| public async Task<IActionResult> UnEnroll([FromRoute] string id, [FromBody] UnEnrollmentRequest payload) | |
| { | |
| await _enrollmentService.UnEnrollService(id, input); | |
| return Ok(); | |
| } | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class EncryptedEnrollmentRequest | |
| { | |
| public string EncryptedData { get; set; } | |
| public string EncryptedKey { get; set; } | |
| public string PublicKeyFingerprint { get; set; } | |
| public string HashingAlgorithm { get; set; } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class InitRequest | |
| { | |
| public string ServiceName { get; set; } | |
| public string ServiceProviderName { get; set; } | |
| public bool Sandbox { get; set; } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class UnEnrollmentRequest | |
| { | |
| public string ServiceId { get; set; } | |
| public string TenantId { get; set; } | |
| //other parameters included as part of OperationUrl are passed here | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment