Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
74f5d37
fix: refactor Jamf Protect functions
neilmartin83 May 12, 2025
4dc5a5a
Merge remote-tracking branch 'upstream/main'
neilmartin83 May 14, 2025
e63bed2
Merge remote-tracking branch 'upstream/main'
neilmartin83 May 18, 2025
287f974
Merge remote-tracking branch 'upstream/main'
neilmartin83 May 20, 2025
3243f0b
Merge remote-tracking branch 'upstream/main'
neilmartin83 May 30, 2025
728b9cf
Merge remote-tracking branch 'upstream/main'
neilmartin83 Jun 6, 2025
d6c1799
Merge remote-tracking branch 'upstream/main'
neilmartin83 Jun 10, 2025
fecc3bb
Merge branch 'deploymenttheory:main' into main
neilmartin83 Jun 15, 2025
db1e131
Merge remote-tracking branch 'upstream/main'
neilmartin83 Jun 17, 2025
791e3e5
Merge remote-tracking branch 'upstream/main'
neilmartin83 Jun 24, 2025
45cf344
Merge remote-tracking branch 'upstream/main'
neilmartin83 Jun 25, 2025
db6d325
Merge remote-tracking branch 'upstream/main'
neilmartin83 Jul 2, 2025
b5b5456
Merge remote-tracking branch 'upstream/main'
neilmartin83 Jul 5, 2025
ead635b
Merge remote-tracking branch 'upstream/main'
neilmartin83 Jul 11, 2025
eef6aa1
Merge remote-tracking branch 'upstream/main'
neilmartin83 Jul 26, 2025
08d4783
feat: add OIDC Direct IdP Login URL retrieval functionality /v1/oidc/…
neilmartin83 Jul 26, 2025
47952f9
Merge branch 'deploymenttheory:main' into nm-oidc-11-19
neilmartin83 Jul 31, 2025
2fce677
chore: update API reference for OIDC Direct IdP Login URL
neilmartin83 Jul 31, 2025
073ece4
Merge remote-tracking branch 'upstream/main' into nm-oidc-11-19
neilmartin83 Aug 11, 2025
094e311
Merge remote-tracking branch 'upstream/main' into nm-oidc-11-19
neilmartin83 Aug 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import (
"encoding/json"
"fmt"
"log"

"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
)

func main() {
// Define the path to the JSON configuration file
configFilePath := "/Users/Shared/GitHub/go-api-sdk-jamfpro/localtesting/clientconfig.json"

// Initialize the Jamf Pro client with the HTTP client configuration
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
if err != nil {
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
}

// Get the OIDC Direct IdP Login URL
oIDCDirectIdPLoginURLResponse, err := client.GetDirectURLForOIDCLogin()
if err != nil {
log.Fatalf("Error retrieving OIDC direct IdP login URL: %v", err)
}

// Pretty print the response in JSON
oIDCDirectIdPLoginURLJSON, err := json.MarshalIndent(oIDCDirectIdPLoginURLResponse, "", " ")
if err != nil {
log.Fatalf("Error marshaling OIDC direct IdP login URL data: %v", err)
}
fmt.Println("OIDC Direct IdP Login URL Details:\n", string(oIDCDirectIdPLoginURLJSON))
}
25 changes: 24 additions & 1 deletion sdk/jamfpro/jamfproapi_oidc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// jamfproapi_oidc.go
// Jamf Pro Api - OIDC
// api reference: https://developer.jamf.com/jamf-pro/reference/get_v1-oidc-public-key
// https://developer.jamf.com/jamf-pro/reference/get_v1-oidc-direct-idp-login-url
// Jamf Pro Api requires the structs to support an JSON data structure.

package jamfpro
Expand All @@ -9,7 +10,12 @@ import "fmt"

const uriOIDC = "/api/v1/oidc"

// ResponseOIDCPublicKeyrepresents the response structure for the OIDC public key.
// ResponseOIDCDirectIdPLoginURL represents the response structure for the OIDC Direct IdP Login URL.
type ResponseOIDCDirectIdPLoginURL struct {
URL string `json:"url"`
}

// ResponseOIDCPublicKey represents the response structure for the OIDC public key.
type ResponseOIDCPublicKey struct {
Keys []ResourceOIDCKey `json:"keys"`
}
Expand All @@ -36,6 +42,23 @@ type ResponseOIDCRedirectURL struct {
RedirectURL string `json:"redirectUrl"`
}

// GetDirectURLForOIDCLogin retrieves the direct IdP login URL for OIDC.
func (c *Client) GetDirectURLForOIDCLogin() (*ResponseOIDCDirectIdPLoginURL, error) {
endpoint := fmt.Sprintf("%s/direct-idp-login-url", uriOIDC)

var response ResponseOIDCDirectIdPLoginURL
resp, err := c.HTTP.DoRequest("GET", endpoint, nil, &response)
if err != nil {
return nil, fmt.Errorf("failed to get OIDC direct IdP login URL: %v", err)
}

if resp != nil && resp.Body != nil {
defer resp.Body.Close()
}

return &response, nil
}

// GetPublicKeyOfOIDCKeystore retrieves the public key of the keystore used for signing OIDC messages as a JWT.
func (c *Client) GetPublicKeyOfOIDCKeystore() (*ResponseOIDCPublicKey, error) {
endpoint := fmt.Sprintf("%s/public-key", uriOIDC)
Expand Down
Loading