-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Ferlab-Ste-Justine/feature/SKFP-11_userid_…
…authorizer SKFP-11: add UseridAuthorizer.javad
- Loading branch information
Showing
4 changed files
with
57 additions
and
13 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 bio.ferlab.pac4j; | ||
|
||
import org.pac4j.core.authorization.authorizer.AbstractRequireAnyAuthorizer; | ||
import org.pac4j.core.context.WebContext; | ||
import org.pac4j.core.context.session.SessionStore; | ||
import org.pac4j.core.profile.UserProfile; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public final class UseridAuthorizer extends AbstractRequireAnyAuthorizer<String> { | ||
|
||
public UseridAuthorizer() { } | ||
|
||
public UseridAuthorizer(final String... ids) { | ||
setElements(ids); | ||
} | ||
|
||
public UseridAuthorizer(final List<String> ids) { | ||
setElements(ids); | ||
} | ||
|
||
public UseridAuthorizer(final Set<String> ids) { setElements(ids); } | ||
|
||
@Override | ||
protected boolean check(WebContext context, SessionStore sessionStore, UserProfile profile, String element) { | ||
return element.equals(profile.getId()); | ||
} | ||
} |
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