</computeroutput></literallayout>
</para>
<para>
+ Depending on the identity method, you may also need to add a list of comma-separated
+ realms that are allowed to be used with an identity. For example, the oauth method
+ requires a list of domains that the OAuth authentication plugin is allowed to contact:
+ <literallayout><computeroutput>
+<userinput>> gsso-example --create-identity="Test Google identity" --identity-method=oauth --identity-realms=google.com</userinput>
+Identity stored with id 29
+ </computeroutput></literallayout>
+ </para>
+ <para>
To remove an identity, use <userinput>--remove-identity</userinput> option
with identity id:
<literallayout><computeroutput>
}
static void create_auth_identity(GMainLoop* main_loop, const gchar* identity_caption,
- const gchar* identity_method)
+ const gchar* identity_method, const gchar* allowed_realms)
{
const gchar* all_mechanisms[] = { "*", NULL };
if (g_strcmp0(identity_method, "password") == 0)
signon_identity_info_set_secret(identity_info, NULL, TRUE);
+ if (allowed_realms != NULL) {
+ gchar** realms_array = g_strsplit(allowed_realms, ",", 0);
+ signon_identity_info_set_realms(identity_info, (const gchar* const *) realms_array);
+ g_strfreev(realms_array);
+ }
+
signon_identity_store_credentials_with_info (identity,
identity_info,
signon_store_identity_cb,
gboolean query_identities = FALSE;
gchar* create_identity_caption = NULL;
gchar* create_identity_method = NULL;
+ gchar* create_identity_realms = NULL;
gint remove_identity_id = 0;
GOptionEntry main_entries[] =
{ "query-identities", 0, 0, G_OPTION_ARG_NONE, &query_identities, "Query available authentication identities", NULL},
{ "create-identity", 0, 0, G_OPTION_ARG_STRING, &create_identity_caption, "Create a new authentication identity", "caption"},
{ "identity-method", 0, 0, G_OPTION_ARG_STRING, &create_identity_method, "Method to use when creating identity", "method"},
+ { "identity-realms", 0, 0, G_OPTION_ARG_STRING, &create_identity_realms, "A comma-separated list of allowed realms for the identity", "realms"},
{ "remove-identity", 0, 0, G_OPTION_ARG_INT, &remove_identity_id, "Remove an authentication identity", "id"},
{ NULL }
};
} else if (query_identities) {
query_auth_identities(main_loop);
} else if (create_identity_caption) {
- create_auth_identity(main_loop, create_identity_caption, create_identity_method);
+ create_auth_identity(main_loop, create_identity_caption, create_identity_method, create_identity_realms);
} else if (remove_identity_id > 0) {
remove_auth_identity(main_loop, remove_identity_id);
} else if (google_identity_id > 0) {
g_free(query_mechanisms_method);
if (create_identity_caption)
g_free(create_identity_caption);
- if (create_identity_caption)
+ if (create_identity_method)
g_free(create_identity_method);
+ if (create_identity_realms)
+ g_free(create_identity_realms);
}