-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented in-memory TokenStore and added opportunity to save user credentials into file #129
Merged
garrettjonesgoogle
merged 22 commits into
googleapis:master
from
YuryBandarchuk16:MemoryCrenetialsStorage
Nov 2, 2017
Merged
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
4fa1b0d
Created MemoryCredentialsStorage and implemented added opportunity to…
YuryBandarchuk16 9cfc14d
Moved TokenStore.java to another directory
YuryBandarchuk16 48ff167
Comments added
YuryBandarchuk16 dd03f9d
Tests for UserAuthorizer updated
YuryBandarchuk16 71adc52
Renamed MemoryCredentialsStorage to MemoryTokensStorage
YuryBandarchuk16 8208263
Tests for UserCredentials updated
YuryBandarchuk16 b44d07d
Java header added
YuryBandarchuk16 8adc97a
small fixes
YuryBandarchuk16 431453d
Used MemoryTokenStorage as default for UserAuthorizer
YuryBandarchuk16 c3feabc
Comments regrading credentials
YuryBandarchuk16 5fcddeb
Removed unnecessary test
YuryBandarchuk16 7bcfeab
Add apache.commons.io dependency and update the implementation of 'sa…
YuryBandarchuk16 b28a59b
Merge branch 'MemoryCrenetialsStorage' of https://github.com/YuryBand…
YuryBandarchuk16 32e098d
Merge branch 'master' into MemoryCrenetialsStorage
YuryBandarchuk16 46ea6af
Returned pom.xml to its previous state, used Guava 'ByteStreams.copy'…
YuryBandarchuk16 7845198
Move storage implementation to its original package.
YuryBandarchuk16 de94bcc
Update the implementation of saving user credentials, fix issues with…
YuryBandarchuk16 366e718
Merge branch 'master' into MemoryCrenetialsStorage
YuryBandarchuk16 8e59f30
Merge branch 'master' into MemoryCrenetialsStorage
YuryBandarchuk16 4026b3a
Use temporary files for tests, move generic implementation to 'OAuth2…
YuryBandarchuk16 e3d8020
Update method name to 'writeInputStreamToFile'.
YuryBandarchuk16 7f60405
Merge branch 'master' into MemoryCrenetialsStorage
YuryBandarchuk16 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
oauth2_http/java/com/google/auth/oauth2/storage/MemoryTokensStorage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2017, Google Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are | ||
* met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following disclaimer | ||
* in the documentation and/or other materials provided with the | ||
* distribution. | ||
* | ||
* * Neither the name of Google Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
package com.google.auth.oauth2.storage; | ||
|
||
import java.io.IOException; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class MemoryTokensStorage implements TokenStore { | ||
|
||
private final Map<String, String> tokensStorage = new HashMap<>(); | ||
This comment was marked as spam.
Sorry, something went wrong. |
||
|
||
@Override | ||
public String load(String id) throws IOException { | ||
return tokensStorage.get(id); | ||
} | ||
|
||
@Override | ||
public void store(String id, String tokens) throws IOException { | ||
tokensStorage.put(id, tokens); | ||
} | ||
|
||
@Override | ||
public void delete(String id) throws IOException { | ||
tokensStorage.remove(id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.