如何自定义Mac OSX登录? [英] How to customize the Mac OSX login?

查看:156
本文介绍了如何自定义Mac OSX登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为任何Apple的Macbook自定义整个登录屏幕和功能.

I need to customize the whole login screen and functionality for any Apple`s Macbook.

通常的想法是在用户凭据下进行控制,以在外部身份验证服务器上对该用户进行身份验证.

The general idea is to have control under the user credentials to authenticate this user on a external authentication server.

因此,自定义UI非常重要,例如为第二次密码输入添加新的TextField或显示类似QR Code的图像.

Thus, it's important to customize the UI, like adding a new TextField for a second password input or displaying a image like a QR Code.

在进行了一些研究之后,我只发现了两个相关的项目:

After digging some research, I`ve found out only two relevant projects:

1- https://github.com/skycocker/NameAndPassword

但是它是4年前的,似乎已经过时了.

However it is from 4 years ago and it seems outdated.

2- https://developer.apple.com/library/content/samplecode /PreLoginAgents/Introduction/Intro.html

2 - https://developer.apple.com/library/content/samplecode/PreLoginAgents/Introduction/Intro.html

我已经从Apple部署了 PreLoginAgent 的示例代码,但是它仅在登录时打开外部应用程序.

And I've deployed the sample code for the PreLoginAgent from Apple, however it only opens an external application on login.

  • 在Mac OSX身份验证中处理自定义的最合适方法是什么?

注意:我正在寻找一种可以避免再次中断登录的解决方案.

推荐答案

我不确定您为什么要取消第一个链接(

I'm not sure why you discount your first link (NameAndPassword)

它是Apple的 SFAuthorizationPluginView 的示例项目的固定"版本.这是您需要使用的类.不幸的是,如您所见,Apple自己的示例未进行编译,而且文档非常薄,使它正常工作可能很棘手.

It's a "fixed" version of one of Apple's sample projects for SFAuthorizationPluginView. That is the class you need to use. Unfortunately as you see by Apple's own sample not compiling, and the very thin documentation, it might be tricky to get it working.

但是,我从上面的链接中提取了项目,并将其编译到了我的计算机上.

However, I took the project from the link above and compiled it on my machine.

然后我将生成的.bundle复制到/Library/Security/SecurityAgentPlugins

Then I copied the resulting .bundle to /Library/Security/SecurityAgentPlugins

接下来,您需要在授权数据库中注册插件:

Next you need to register the plugin in the authorization database:

  1. security authorizationdb read system.login.console > outfile.plist
  2. 通过替换来修改outfileplist:

<string>loginwindow:login</string>

具有: <string>NameAndPassword:invoke</string>

  1. 现在,更新数据库:

security authorizationdb write system.login.console < outfile.plist

现在,注销,登录屏幕将显示自定义视图.

Now, log out and the login screen will reflect the custom view.

一旦安装,您提供的链接就是一个很好的简单PoC.如果您在定制SFAuthorizationPluginView以执行所需操作时需要其他帮助,建议您围绕此问题提出具体问题.

Once installed, the link you provided is a good simple PoC. If you need additional help in customising your SFAuthorizationPluginView to do what you want, I suggest you post specific questions around that.

仅因为API较旧并不意味着它已过时.这些年来,登录屏幕没有太大变化.对于过时的示例和不完善的文档,这似乎是这些更深奥的macOS开发人员功能的典型代表.

Just because the API is older does not mean it's out of date. The login screen has not changed a lot over the years. As for the out-of-date samples and poor documentation, that seems fairly typical of these more esoteric macOS developer features.

有用的链接:

自定义登录屏幕Mac OSX(SFAuthorizationPluginView)

在OS X Mavericks中的自定义登录/锁定屏幕

https://developer.apple.com/documentation/securityinterface/sfauthorizationpluginview

这篇关于如何自定义Mac OSX登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆