-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
643 additions
and
557 deletions.
There are no files selected for viewing
83 changes: 50 additions & 33 deletions
83
Idra/src/main/java/it/eng/idra/authentication/AuthenticationManager.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 |
---|---|---|
@@ -1,33 +1,50 @@ | ||
package it.eng.idra.authentication; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.ws.rs.core.Response; | ||
|
||
import it.eng.idra.beans.ODFAuthenticationMethod; | ||
import it.eng.idra.beans.ODFProperty; | ||
import it.eng.idra.utils.PropertyManager; | ||
|
||
public abstract class AuthenticationManager { | ||
|
||
public abstract Object login(String username, String password, String code) throws Exception; | ||
|
||
public abstract Response logout(HttpServletRequest username) throws Exception; | ||
|
||
public abstract Object getToken(String username, String code) throws Exception; | ||
|
||
public abstract Boolean validateToken(Object token) throws Exception; | ||
|
||
public abstract Class<?> getFilterClass() throws ClassNotFoundException; | ||
|
||
public static AuthenticationManager getActiveAuthenticationManager() { | ||
|
||
switch (ODFAuthenticationMethod.valueOf(PropertyManager.getProperty(ODFProperty.AUTHENTICATION_METHOD))) { | ||
|
||
case FIWARE: | ||
return FiwareIDMAuthenticationManager.getInstance(); | ||
default: | ||
return BasicAuthenticationManager.getInstance(); | ||
} | ||
|
||
} | ||
} | ||
/******************************************************************************* | ||
* Idra - Open Data Federation Platform | ||
* Copyright (C) 2018 Engineering Ingegneria Informatica S.p.A. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
******************************************************************************/ | ||
package it.eng.idra.authentication; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.ws.rs.core.Response; | ||
|
||
import it.eng.idra.beans.ODFAuthenticationMethod; | ||
import it.eng.idra.beans.ODFProperty; | ||
import it.eng.idra.utils.PropertyManager; | ||
|
||
public abstract class AuthenticationManager { | ||
|
||
public abstract Object login(String username, String password, String code) throws Exception; | ||
|
||
public abstract Response logout(HttpServletRequest username) throws Exception; | ||
|
||
public abstract Object getToken(String username, String code) throws Exception; | ||
|
||
public abstract Boolean validateToken(Object token) throws Exception; | ||
|
||
public abstract Class<?> getFilterClass() throws ClassNotFoundException; | ||
|
||
public static AuthenticationManager getActiveAuthenticationManager() { | ||
|
||
switch (ODFAuthenticationMethod.valueOf(PropertyManager.getProperty(ODFProperty.AUTHENTICATION_METHOD))) { | ||
|
||
case FIWARE: | ||
return FiwareIDMAuthenticationManager.getInstance(); | ||
default: | ||
return BasicAuthenticationManager.getInstance(); | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.