1 /* Copyright (c) 2012 Apple Inc. All rights reserved. */
3 #ifndef _SECURITY_AUTH_AUTHTOKEN_H_
4 #define _SECURITY_AUTH_AUTHTOKEN_H_
6 #include "credential.h"
7 #include <CoreFoundation/CoreFoundation.h>
9 #if defined(__cplusplus)
14 auth_token_state_zombie
= 1 << 0,
15 auth_token_state_registered
= 1 << 1
17 typedef uint32_t auth_token_state_t
;
19 extern const CFDictionaryKeyCallBacks kAuthTokenKeyCallBacks
;
21 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
22 auth_token_t
auth_token_create(process_t
,bool operateAsLeastPrivileged
);
24 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
25 auth_token_t
auth_token_create_with_audit_info(const audit_info_s
*,bool operateAsLeastPrivileged
);
28 bool auth_token_get_sandboxed(auth_token_t
);
31 const char * auth_token_get_code_url(auth_token_t
);
34 const void * auth_token_get_key(auth_token_t
);
37 auth_items_t
auth_token_get_context(auth_token_t
);
40 bool auth_token_least_privileged(auth_token_t
);
43 uid_t
auth_token_get_uid(auth_token_t
);
46 pid_t
auth_token_get_pid(auth_token_t
);
49 session_t
auth_token_get_session(auth_token_t
);
52 const AuthorizationBlob
* auth_token_get_blob(auth_token_t
);
55 const audit_info_s
* auth_token_get_audit_info(auth_token_t
);
58 mach_port_t
auth_token_get_creator_bootstrap(auth_token_t auth
);
61 CFIndex
auth_token_add_process(auth_token_t
,process_t
);
64 CFIndex
auth_token_remove_process(auth_token_t
,process_t
);
67 CFIndex
auth_token_get_process_count(auth_token_t
);
70 void auth_token_set_credential(auth_token_t
,credential_t
);
73 bool auth_token_credentials_iterate(auth_token_t
, credential_iterator_t iter
);
76 void auth_token_set_right(auth_token_t
,credential_t
);
79 bool auth_token_rights_iterate(auth_token_t
, credential_iterator_t iter
);
82 CFTypeRef
auth_token_copy_entitlement_value(auth_token_t
, const char * entitlement
);
85 bool auth_token_has_entitlement(auth_token_t
, const char * entitlement
);
88 bool auth_token_has_entitlement_for_right(auth_token_t
, const char * right
);
91 credential_t
auth_token_get_credential(auth_token_t
);
94 bool auth_token_apple_signed(auth_token_t
);
97 bool auth_token_is_creator(auth_token_t
,process_t
);
100 void auth_token_set_state(auth_token_t
,auth_token_state_t
);
103 void auth_token_clear_state(auth_token_t
,auth_token_state_t
);
105 AUTH_WARN_RESULT AUTH_NONNULL_ALL
106 auth_token_state_t
auth_token_get_state(auth_token_t
);
109 bool auth_token_check_state(auth_token_t
, auth_token_state_t
);
111 #if defined(__cplusplus)
115 #endif /* !_SECURITY_AUTH_AUTHTOKEN_H_ */