Skip to content

Commit fa8443c

Browse files
authored
agent: add windows resources (#418)
1 parent a06e7c4 commit fa8443c

10 files changed

Lines changed: 33 additions & 139 deletions

File tree

cmd/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.syso

cmd/agent_local/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ clean:
1919
"$(MAKE)" -C ${TOP} ee/psso/clean || true
2020

2121
build:
22-
echo "${TOP}/bin/${TARGET}"
2322
mkdir -p "${TOP}/bin/${TARGET}"
23+
ifeq ($(OS),Windows_NT)
24+
$(call go_generate_resources,authentik Platform Agent)
25+
endif
2426
go build \
2527
${GO_BUILD_FLAGS} \
2628
-o "${TOP}/bin/${TARGET}/${BINARY_NAME}" \

cmd/agent_system/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ clean:
1414
.PHONY: build
1515
build:
1616
mkdir -p "${TOP}/bin/${TARGET}"
17+
ifeq ($(OS),Windows_NT)
18+
$(call go_generate_resources,authentik Platform System Service)
19+
endif
1720
go build \
1821
${GO_BUILD_FLAGS} \
1922
-o "${TOP}/bin/${TARGET}/${BINARY_NAME}" \

cmd/browser_support/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ clean:
1414
.PHONY: build
1515
build:
1616
mkdir -p "${TOP}/bin/${TARGET}"
17+
ifeq ($(OS),Windows_NT)
18+
$(call go_generate_resources,authentik Platform Browser Support)
19+
endif
1720
go build \
1821
${GO_BUILD_FLAGS} \
1922
-o "${TOP}/bin/${TARGET}/${BINARY_NAME}" \

cmd/cli/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ clean:
1212

1313
build:
1414
mkdir -p "${TOP}/bin/${TARGET}"
15+
ifeq ($(OS),Windows_NT)
16+
$(call go_generate_resources,authentik Platform CLI)
17+
endif
1518
go build \
1619
${GO_BUILD_FLAGS} \
1720
-o "${TOP}/bin/${TARGET}/${BINARY_NAME}" \

common.mk

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,16 @@ define sentry_upload_symbols
2828
--project platform \
2929
$(1)
3030
endef
31+
32+
define go_generate_resources
33+
go tool goversioninfo \
34+
-icon="${TOP}/cmd/agent_local/package/windows/resources/icon.ico" \
35+
-company="Authentik Security Inc." \
36+
-copyright="2025 Authentik Security Inc." \
37+
-file-version=${VERSION} \
38+
-product-version=${VERSION} \
39+
-comment="$(1)" \
40+
-description="$(1)" \
41+
-product-name="$(1)" \
42+
-skip-versioninfo
43+
endef

ee/wcp/ak_cred_provider/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,10 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
5757
${CREDUI_LIB_PATH}
5858
${SECUR32_LIB_PATH}
5959
${SHLWAPI_LIB_PATH}
60-
#${CEFSIMPLE_LIB_PATH}
61-
# ${LIBCEF_LIB_PATH}
6260
cefsimple
6361
authentik_sys_bridge
6462
spdlog
6563
sentry
66-
# libcef_lib
67-
# libcef_dll_wrappe
6864
)
6965

7066
# TODO: Add tests and install targets if needed.

ee/wcp/cefsimple/CMakeLists.txt

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -98,140 +98,6 @@ endif()
9898
SET_CEF_TARGET_OUT_DIR()
9999

100100

101-
#
102-
# Linux configuration.
103-
#
104-
105-
if(OS_LINUX)
106-
# Executable target.
107-
add_executable(${CEF_TARGET} ${CEFSIMPLE_SRCS})
108-
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
109-
add_dependencies(${CEF_TARGET} ak_cred_provider)
110-
target_link_libraries(${CEF_TARGET} libcef_lib ak_cred_provider ${CEF_STANDARD_LIBS})
111-
112-
# Set rpath so that libraries can be placed next to the executable.
113-
set_target_properties(${CEF_TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN")
114-
set_target_properties(${CEF_TARGET} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
115-
set_target_properties(${CEF_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
116-
117-
# Copy binary and resource files to the target output directory.
118-
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")
119-
COPY_FILES("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${CEF_TARGET_OUT_DIR}")
120-
if (EXISTS "${CEF_BINARY_DIR}/libminigbm.so")
121-
COPY_FILES("${CEF_TARGET}" "libminigbm.so" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")
122-
endif()
123-
124-
# Set SUID permissions on the chrome-sandbox target.
125-
SET_LINUX_SUID_PERMISSIONS("${CEF_TARGET}" "${CEF_TARGET_OUT_DIR}/chrome-sandbox")
126-
endif()
127-
128-
129-
#
130-
# Mac OS X configuration.
131-
#
132-
133-
if(OS_MAC)
134-
option(OPTION_USE_ARC "Build with ARC (automatic Reference Counting) on macOS." ON)
135-
if(OPTION_USE_ARC)
136-
list(APPEND CEF_COMPILER_FLAGS
137-
-fobjc-arc
138-
)
139-
set_target_properties(${target} PROPERTIES
140-
CLANG_ENABLE_OBJC_ARC "YES"
141-
)
142-
endif()
143-
144-
# Output path for the main app bundle.
145-
set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
146-
147-
# Variables referenced from the main Info.plist file.
148-
set(EXECUTABLE_NAME "${CEF_TARGET}")
149-
set(PRODUCT_NAME "${CEF_TARGET}")
150-
151-
if(USE_SANDBOX)
152-
# Logical target used to link the cef_sandbox library.
153-
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
154-
endif()
155-
156-
# Main app bundle target.
157-
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFSIMPLE_RESOURCES_SRCS} ${CEFSIMPLE_SRCS})
158-
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_TARGET})
159-
add_dependencies(${CEF_TARGET} ak_cred_provider)
160-
target_link_libraries(${CEF_TARGET} ak_cred_provider ${CEF_STANDARD_LIBS})
161-
set_target_properties(${CEF_TARGET} PROPERTIES
162-
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist.in
163-
)
164-
165-
# Copy the CEF framework into the Frameworks directory.
166-
add_custom_command(
167-
TARGET ${CEF_TARGET}
168-
POST_BUILD
169-
COMMAND ${CMAKE_COMMAND} -E copy_directory
170-
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
171-
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
172-
VERBATIM
173-
)
174-
175-
# Create the multiple Helper app bundle targets.
176-
foreach(_suffix_list ${CEF_HELPER_APP_SUFFIXES})
177-
# Convert to a list and extract the suffix values.
178-
string(REPLACE ":" ";" _suffix_list ${_suffix_list})
179-
list(GET _suffix_list 0 _name_suffix)
180-
list(GET _suffix_list 1 _target_suffix)
181-
list(GET _suffix_list 2 _plist_suffix)
182-
183-
# Define Helper target and output names.
184-
set(_helper_target "${CEF_HELPER_TARGET}${_target_suffix}")
185-
set(_helper_output_name "${CEF_HELPER_OUTPUT_NAME}${_name_suffix}")
186-
187-
# Create Helper-specific variants of the helper-Info.plist file. Do this
188-
# manually because the configure_file command (which is executed as part of
189-
# MACOSX_BUNDLE_INFO_PLIST) uses global env variables and would insert the
190-
# wrong values with multiple targets.
191-
set(_helper_info_plist "${CMAKE_CURRENT_BINARY_DIR}/helper-Info${_target_suffix}.plist")
192-
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist.in" _plist_contents)
193-
string(REPLACE "\${EXECUTABLE_NAME}" "${_helper_output_name}" _plist_contents ${_plist_contents})
194-
string(REPLACE "\${PRODUCT_NAME}" "${_helper_output_name}" _plist_contents ${_plist_contents})
195-
string(REPLACE "\${BUNDLE_ID_SUFFIX}" "${_plist_suffix}" _plist_contents ${_plist_contents})
196-
file(WRITE ${_helper_info_plist} ${_plist_contents})
197-
198-
# Create Helper executable target.
199-
add_executable(${_helper_target} MACOSX_BUNDLE ${CEFSIMPLE_HELPER_SRCS})
200-
SET_EXECUTABLE_TARGET_PROPERTIES(${_helper_target})
201-
add_dependencies(${_helper_target} ak_cred_provider)
202-
target_link_libraries(${_helper_target} ak_cred_provider ${CEF_STANDARD_LIBS})
203-
set_target_properties(${_helper_target} PROPERTIES
204-
MACOSX_BUNDLE_INFO_PLIST ${_helper_info_plist}
205-
OUTPUT_NAME ${_helper_output_name}
206-
)
207-
208-
if(USE_SANDBOX)
209-
target_link_libraries(${_helper_target} cef_sandbox_lib)
210-
endif()
211-
212-
# Add the Helper as a dependency of the main executable target.
213-
add_dependencies(${CEF_TARGET} "${_helper_target}")
214-
215-
# Copy the Helper app bundle into the Frameworks directory.
216-
add_custom_command(
217-
TARGET ${CEF_TARGET}
218-
POST_BUILD
219-
COMMAND ${CMAKE_COMMAND} -E copy_directory
220-
"${CEF_TARGET_OUT_DIR}/${_helper_output_name}.app"
221-
"${CEF_APP}/Contents/Frameworks/${_helper_output_name}.app"
222-
VERBATIM
223-
)
224-
endforeach()
225-
226-
# Manually process and copy over resource files.
227-
# The Xcode generator can support this via the set_target_properties RESOURCE
228-
# directive but that doesn't properly handle nested resource directories.
229-
# Remove these prefixes from input file paths.
230-
set(PREFIXES "mac/")
231-
COPY_MAC_RESOURCES("${CEFSIMPLE_RESOURCES_SRCS}" "${PREFIXES}" "${CEF_TARGET}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_APP}")
232-
endif()
233-
234-
235101
#
236102
# Windows configuration.
237103
#

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ require (
5353
github.com/Masterminds/semver/v3 v3.3.1 // indirect
5454
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
5555
github.com/ProtonMail/go-crypto v1.3.0 // indirect
56+
github.com/akavel/rsrc v0.10.2 // indirect
5657
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 // indirect
5758
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 // indirect
5859
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect
@@ -95,6 +96,7 @@ require (
9596
github.com/inconshreveable/mousetrap v1.1.0 // indirect
9697
github.com/invopop/jsonschema v0.13.0 // indirect
9798
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
99+
github.com/josephspurrier/goversioninfo v1.5.0 // indirect
98100
github.com/json-iterator/go v1.1.12 // indirect
99101
github.com/jstemmer/go-junit-report/v2 v2.1.0 // indirect
100102
github.com/kevinburke/ssh_config v1.2.0 // indirect
@@ -153,6 +155,7 @@ require (
153155

154156
tool (
155157
github.com/goreleaser/nfpm/v2/cmd/nfpm
158+
github.com/josephspurrier/goversioninfo/cmd/goversioninfo
156159
github.com/jstemmer/go-junit-report/v2
157160
google.golang.org/grpc/cmd/protoc-gen-go-grpc
158161
google.golang.org/protobuf/cmd/protoc-gen-go

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ github.com/ProtonMail/gopenpgp/v2 v2.7.1 h1:Awsg7MPc2gD3I7IFac2qE3Gdls0lZW8SzrFZ
2929
github.com/ProtonMail/gopenpgp/v2 v2.7.1/go.mod h1:/BU5gfAVwqyd8EfC3Eu7zmuhwYQpKs+cGD8M//iiaxs=
3030
github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78=
3131
github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ=
32+
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
33+
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
3234
github.com/aletheia7/ul v1.5.0 h1:9zBVP4Z2mpky36i92/bwjq+iRsn5rIli1w/uam4OjaA=
3335
github.com/aletheia7/ul v1.5.0/go.mod h1:phZ/+NW72pFssEYvoGuilY35jpzIbW8utY0oGF5yjxI=
3436
github.com/alexw23/go-keychain v0.0.0-20240507145345-41efe171240e h1:tr4NMs+H918AUrqOpYkjfeZDg7554ufuQXS/Ego/JRU=
@@ -198,6 +200,8 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl
198200
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
199201
github.com/johnbellone/grpc-middleware-sentry v0.4.0 h1:4Ojhjv+/1skH2wLMkNGWtYHo+iwiOnLZV3dn7KUhCvc=
200202
github.com/johnbellone/grpc-middleware-sentry v0.4.0/go.mod h1:o017YrGIUqWfhPMbcg/Jg2CTeLTdbGRkuEQywqcDVqY=
203+
github.com/josephspurrier/goversioninfo v1.5.0 h1:9TJtORoyf4YMoWSOo/cXFN9A/lB3PniJ91OxIH6e7Zg=
204+
github.com/josephspurrier/goversioninfo v1.5.0/go.mod h1:6MoTvFZ6GKJkzcdLnU5T/RGYUbHQbKpYeNP0AgQLd2o=
201205
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
202206
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
203207
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=

0 commit comments

Comments
 (0)