1 /* Copyright (c) 2012-2013 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
);
25 bool auth_token_get_sandboxed(auth_token_t
);
28 const char * auth_token_get_code_url(auth_token_t
);
31 const void * auth_token_get_key(auth_token_t
);
34 auth_items_t
auth_token_get_context(auth_token_t
);
37 bool auth_token_least_privileged(auth_token_t
);
40 uid_t
auth_token_get_uid(auth_token_t
);
43 pid_t
auth_token_get_pid(auth_token_t
);
46 session_t
auth_token_get_session(auth_token_t
);
49 const AuthorizationBlob
* auth_token_get_blob(auth_token_t
);
52 const audit_info_s
* auth_token_get_audit_info(auth_token_t
);
55 mach_port_t
auth_token_get_creator_bootstrap(auth_token_t auth
);
58 CFIndex
auth_token_add_process(auth_token_t
,process_t
);
61 CFIndex
auth_token_remove_process(auth_token_t
,process_t
);
64 CFIndex
auth_token_get_process_count(auth_token_t
);
67 void auth_token_set_credential(auth_token_t
,credential_t
);
70 bool auth_token_credentials_iterate(auth_token_t
, credential_iterator_t iter
);
73 void auth_token_set_right(auth_token_t
,credential_t
);
76 CFTypeRef
auth_token_copy_entitlement_value(auth_token_t
, const char * entitlement
);
79 bool auth_token_has_entitlement(auth_token_t
, const char * entitlement
);
82 bool auth_token_has_entitlement_for_right(auth_token_t
, const char * right
);
85 credential_t
auth_token_get_credential(auth_token_t
);
88 bool auth_token_apple_signed(auth_token_t
);
91 bool auth_token_is_creator(auth_token_t
,process_t
);
94 void auth_token_set_state(auth_token_t
,auth_token_state_t
);
97 void auth_token_clear_state(auth_token_t
,auth_token_state_t
);
99 AUTH_WARN_RESULT AUTH_NONNULL_ALL
100 auth_token_state_t
auth_token_get_state(auth_token_t
);
103 bool auth_token_check_state(auth_token_t
, auth_token_state_t
);
106 CFDataRef
auth_token_get_encryption_key(auth_token_t auth
);
108 #if defined(__cplusplus)
112 #endif /* !_SECURITY_AUTH_AUTHTOKEN_H_ */