Created
October 30, 2011 20:48
-
-
Save runeflobakk/1326422 to your computer and use it in GitHub Desktop.
Hele vote-metoden hvor implementasjonen reflekterer bedre slik vi ville forklart forrutsetningene for brukertilgang.
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
public int vote(Authentication authentication, | |
Object object, | |
Collection<ConfigAttribute> attributes) { | |
Collection<ConfigAttribute> supportedAttributes = | |
select(attributes, new SupportedBy(this)); | |
if (supportedAttributes.isEmpty()) { | |
return ACCESS_ABSTAIN; | |
} | |
Object p = authentication.getPrincipal(); | |
if (p instanceof MyPrincipal | |
&& exists(supportedAttributes, new AcceptingSecurityLevelOf((MyPrincipal) p))) { | |
return ACCESS_GRANTED; | |
} else { | |
return ACCESS_DENIED; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment