-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed some errors in tx generation and processing
- Loading branch information
Showing
13 changed files
with
173 additions
and
72 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package auth; | ||
|
||
import com.feth.play.module.pa.providers.oauth2.google.GoogleAuthUser; | ||
import com.feth.play.module.pa.providers.password.UsernamePasswordAuthUser; | ||
import com.feth.play.module.pa.user.AuthUser; | ||
|
||
/** | ||
* Created by admin on 10/26/2016. | ||
*/ | ||
public class AuthUserAccessor { | ||
|
||
public static String getEmailOf(AuthUser authUser) { | ||
if ("google".equals(authUser.getProvider())) { | ||
return ((GoogleAuthUser) authUser).getEmail(); | ||
} else if ("basic".equals(authUser.getProvider())) { | ||
return ((UsernamePasswordAuthUser) authUser).getEmail(); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
private static GoogleAuthUser toGoogleAuthUser(AuthUser authUser) { | ||
if ("google".equals(authUser.getProvider())) { | ||
return (GoogleAuthUser) authUser; | ||
} else { | ||
return null; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright © 2014 Florian Hars, nMIT Solutions GmbH | ||
* | ||
* 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. | ||
*/ | ||
package auth.basic; | ||
|
||
import com.feth.play.module.pa.PlayAuthenticate; | ||
import com.feth.play.module.pa.providers.password.DefaultUsernamePasswordAuthUser; | ||
import com.feth.play.module.pa.providers.wwwauth.basic.BasicAuthProvider; | ||
import com.feth.play.module.pa.user.AuthUser; | ||
import play.inject.ApplicationLifecycle; | ||
import play.mvc.Http.Context; | ||
import play.twirl.api.Content; | ||
import views.html.login; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
/** | ||
* A really simple basic auth provider that accepts one hard coded user | ||
*/ | ||
@Singleton | ||
public class AlwaysValidBasicAuthProvider extends BasicAuthProvider { | ||
|
||
@Inject | ||
public AlwaysValidBasicAuthProvider(final PlayAuthenticate auth, final ApplicationLifecycle lifecycle) { | ||
super(auth, lifecycle); | ||
} | ||
|
||
@Override | ||
protected AuthUser authenticateUser(String username, String password) { | ||
return new DefaultUsernamePasswordAuthUser(password, username); | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return "basic"; | ||
} | ||
|
||
/** | ||
* Diplay the normal login form if HTTP authentication fails | ||
*/ | ||
@Override | ||
protected Content unauthorized(Context context) { | ||
return login.render(this.auth, null, ""); | ||
} | ||
} |
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
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
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