<commit_before># Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""GITKit federated authentication module.

This module lets Course Builder use the Google Identity Toolkit (GITKit;
https://developers.google.com/identity/toolkit/) in place of the App Engine
users service (https://cloud.google.com/appengine/docs/python/users/) for user
authentication.

GITKit is a federated identity provider, meaning end users can choose from a set
of third-party identity providers (Google, Facebook, etc.) or username/password
via an external service (accountchooser.com). GITKit provides a common interface
for interacting with all of these providers; multiple providers can be enabled
at runtime by configuration; and users can select between any of these providers
each time they authenticate.

Currently, this implementation is known to work with the Google and Facebook
providers. Other providers are likely possible but have not been tested.
Notably, it does not yet support username/password via accountchooser.com, and
any attempts to use email functionality will break.

TODO(johncox): add support for username/password.

The basic authentication flow is

1) User clicks sign in button. This captures some information, most notably
   their desired destination after authentication, that is delegated through the<commit_msg>Update gitkit comments. 	Change on 2015/06/18 by johncox <<EMAIL>> ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=96319484<commit_after># Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""GITKit federated authentication module.

This module lets Course Builder use the Google Identity Toolkit (GITKit;
https://developers.google.com/identity/toolkit/) in place of the App Engine
users service (https://cloud.google.com/appengine/docs/python/users/) for user
authentication.

GITKit is a federated identity provider, meaning end users can choose from a set
of third-party identity providers (Google, Facebook, etc.) or username/password
via an external service (accountchooser.com). GITKit provides a common interface
for interacting with all of these providers; multiple providers can be enabled
at runtime by configuration; and users can select between any of these providers
each time they authenticate.

Currently, this implementation is known to work with the Google and Facebook
providers. Other providers are likely possible but have not been tested.
Notably, we do not yet support username/password via accountchooser.com, and any
attempts to use email functionality (either with Google and Facebook, or with
username/password) will break.

TODO(johncox): add email functionality (forgot password, etc.).
TODO(johncox): add support for username/password.

The basic authentication flow is

1) User clicks sign in button. This captures some information, most notably
   their desired destination after authentication, that is delegated through the
{'fraction_non_alphanumeric': 0.0619071392910634, 'fraction_numerical': 0.008487269096355467, 'mean_word_length': 4.732474964234621, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1673561', 'n_tokens_mistral': 994, 'n_tokens_neox': 954, 'n_words': 523}