Skip to content

Commit

Permalink
Initialize Project
Browse files Browse the repository at this point in the history
  • Loading branch information
HaagP3 committed Aug 4, 2023
1 parent 418b585 commit 699d299
Show file tree
Hide file tree
Showing 28 changed files with 1,040 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github:
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches:
- main

jobs:
build:

runs-on: windows-2019

steps:
- uses: actions/checkout@v1
- name: Install Prerequisites
run: .\build\vsts-prerequisites.ps1
shell: powershell
- name: Validate
run: .\build\vsts-validate.ps1
shell: powershell
- name: Build
run: .\build\vsts-build.ps1 -ApiKey $env:APIKEY
shell: powershell
env:
APIKEY: ${{ secrets.ApiKey }}
15 changes: 15 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on: [pull_request]

jobs:
validate:

runs-on: windows-2019

steps:
- uses: actions/checkout@v1
- name: Install Prerequisites
run: .\build\vsts-prerequisites.ps1
shell: powershell
- name: Validate
run: .\build\vsts-validate.ps1
shell: powershell
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Pascal Haag

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions ResolveEntraID/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Pascal Haag

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
129 changes: 129 additions & 0 deletions ResolveEntraID/ResolveEntraID.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
@{

# Script module or binary module file associated with this manifest.
RootModule = 'ResolveEntraID.psm1'

# Version number of this module.
ModuleVersion = '1.0.0'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = '656edb76-7a06-4a6e-a844-d4ff075dceeb'

# Author of this module
Author = 'Pascal Haag'

# Company or vendor of this module
CompanyName = ' '

# Copyright statement for this module
Copyright = '(c) Pascal Haag. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Module to Resolve Entra IDs'

# Minimum version of the PowerShell engine required by this module
# PowerShellVersion = ''

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(
'MiniGraph'
'PSFramework'
)

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @(

)

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
# CmdletsToExport = '*'

# Variables to export from this module
# VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
# AliasesToExport = '*'

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
# Tags = @()

# A URL to the license for this module.
# LicenseUri = ''

# A URL to the main website for this project.
# ProjectUri = ''

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
# ReleaseNotes = ''

# Prerelease string of this module
# Prerelease = ''

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false

# External dependent modules of this module
# ExternalModuleDependencies = @()

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}

11 changes: 11 additions & 0 deletions ResolveEntraID/ResolveEntraID.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
foreach ($file in Get-ChildItem -Path "$PSScriptRoot/internal/functions" -Filter *.ps1 -Recurse) {
. $file.FullName
}

foreach ($file in Get-ChildItem -Path "$PSScriptRoot/functions" -Filter *.ps1 -Recurse) {
. $file.FullName
}

foreach ($file in Get-ChildItem -Path "$PSScriptRoot/internal/scripts" -Filter *.ps1 -Recurse) {
. $file.FullName
}
5 changes: 5 additions & 0 deletions ResolveEntraID/functions/Clear-MeidIdentityCache.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Clear-MeidIdentityCache {
[CmdletBinding()]
param ()
$script:IdNameMappingTable = @{}
}
10 changes: 10 additions & 0 deletions ResolveEntraID/functions/Get-MeidIdentityProvider.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function Get-MeidIdentityProvider {
[CmdletBinding()]
param (
[string]
$Name = '*'
)
process {
$script:IdentityProvider.Values | Where-Object Name -like $Name
}
}
29 changes: 29 additions & 0 deletions ResolveEntraID/functions/Register-MeidIdentityProvider.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
function Register-MeidIdentityProvider {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string[]]
$Name,

[Parameter(Mandatory)]
[string[]]
$NameProperty,

[Parameter(Mandatory)]
[string[]]
$Query
)
process {
$queries = foreach ($item in $Query){
if($item -match "\{0\}"){ $item; continue}
$item.TrimEnd("/").Replace("{","{{").Replace("}","}}"), "{0}" -join "/"
}
foreach ($entry in $Name) {
$script:IdentityProvider[$entry] = [PSCustomObject]@{
Name = $entry
NameProperty = $NameProperty
Query = $queries
}
}
}
}
65 changes: 65 additions & 0 deletions ResolveEntraID/functions/Resolve-MeidIdentity.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
function Resolve-MeidIdentity {
[CmdletBinding()]
param (
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
[string[]]
$Id,

[Parameter(Mandatory)]
[string[]]
$Provider,

[switch]
$NoCache,

[switch]
$NameOnly
)
begin {
function Write-Result {
[CmdletBinding()]
param (
[string]
$Id,

[string]
$Provider,

[string]
$Value,

[switch]
$NameOnly,

[switch]
$NoCache
)
$result = [PSCustomObject]@{
ID = $Id
Name = $Value
Provider = $Provider
}
if ($NameOnly) { $Value }
else { $result }
if(-not $NoCache) { $script:IdNameMappingTable[$Id] = $result}
}
}
process {
foreach ($entry in $Id) {
if ($entry -notmatch '^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$') {
$entry
continue
}
if ($script:IdNameMappingTable[$entry] -and -not $NoCache) {
Write-Result -Id $entry -Value $script:IdNameMappingTable[$entry].Name -NoCache -Provider $script:IdNameMappingTable[$entry].Provider
continue
}
foreach ($providerName in $Provider){

}
}
}
end {

}
}
3 changes: 3 additions & 0 deletions ResolveEntraID/functions/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Functions

Folder for all the functions the user is supposed to have access to.
3 changes: 3 additions & 0 deletions ResolveEntraID/internal/functions/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Internal > Functions

Folder for all the functions you want the user to not see.
3 changes: 3 additions & 0 deletions ResolveEntraID/internal/scripts/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Internal > Scripts

Put in all the scripts that should be run once during import
5 changes: 5 additions & 0 deletions ResolveEntraID/internal/scripts/variables.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ID for Name mapping
$script:IdNameMappingTable = @{}

# Identity Provider
$script:IdentityProvider = @{}
Loading

0 comments on commit 699d299

Please sign in to comment.