Skip to content

Commit

Permalink
Support for PasswordText in WSS UsernameToken
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Jul 2, 2014
1 parent fd1a8e0 commit a82a3ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Expand Up @@ -26,6 +26,8 @@
import com.evolveum.midpoint.security.api.MidPointPrincipal;
import com.evolveum.midpoint.security.api.UserProfileService;
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
Expand All @@ -36,6 +38,8 @@
* @author Igor Farinic
*/
public class PasswordCallback implements CallbackHandler {

private static final Trace LOGGER = TraceManager.getTrace(PasswordCallback.class);

private UserProfileService userDetailsService;
private Protector protector;
Expand All @@ -46,8 +50,12 @@ public PasswordCallback(UserProfileService userDetailsService, Protector protect
}

public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
LOGGER.trace("Invoked PasswordCallback with {} callbacks: {}", callbacks.length, callbacks);
WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];

String wssPasswordType = pc.getType();
LOGGER.trace("Password type: {}", wssPasswordType);

MidPointPrincipal user;
try {
user = userDetailsService.getPrincipal(pc.getIdentifier());
Expand Down
3 changes: 1 addition & 2 deletions model/model-impl/src/main/resources/ctx-model.xml
Expand Up @@ -407,14 +407,13 @@
<constructor-arg>
<map>
<entry key="action" value="UsernameToken"/>
<entry key="passwordType" value="PasswordDigest"/>
<entry key="passwordCallbackRef">
<ref bean="passwordCallback"/>
</entry>
</map>
</constructor-arg>
</bean>

<bean id="springAuthenticationInjector" class="com.evolveum.midpoint.model.impl.security.SpringAuthenticationInjectorInterceptor">
<constructor-arg name="userDetailsService" ref="userDetailsService"/>
<constructor-arg name="securityEnforcer" ref="securityEnforcer"/>
Expand Down

0 comments on commit a82a3ed

Please sign in to comment.